By rustymac
#1689
Hi,

Ive been trying to create a block in order to use a standard ultrasonic Range finder with Mind+ but havnt been able to get it working.

Is there a block availible for this. The sensor is standard and has GND, VCC, NC and SIG connections.

Cheers
Russell
By rustymac
#1692
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