Forum >Replies by rustymac
userhead rustymac
Replies (1)
  • You Reply: Hi Guys,

    Yes i read through the tutorial. I understand the use of &BI1&, &BO1&, &PI1& and &BO1& for power and data interface to the block.  If i need to use and internal variable for a calculation it is used the same as Arduino IDE?

    For example:

    My variables,
    int pin;      // I assume this would be &BI1&
    long duration;      //And internal variable to be left as is?
    long rangeincentimeters;      //I assume this would be &BO1&

    My Code,
    void loop()
    {
    pinmode(&BI1&, OUTPUT);
    digitalwrite(&BI1&,LOW);
    delaymicroseconds(2);
    digitalwrite(&BI1&,HIGH);
    delaymicroseconds(5);
    digitalwrite(&BI1&,LOW);
    pinmode(&BI1&,INPUT);
    duration=pulsein(pin,HIGH);
    &BO1& = duration/29/2;

    Also does simply saving the new block allow it to be opened in Mind+ automatically? Anytricks to allow Mind+
    to use the new block.

    Regards
    Russell