Forum >Using Ultrasonic Ranger with Mind+
Mind+General

Using Ultrasonic Ranger with Mind+

userHead rustymac 2014-06-22 02:09:22 7594 Views3 Replies
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
2014-07-04 06:09:37 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
userHeadPic rustymac
2014-06-23 21:49:00 rusty,

What problems did you encounter when trying to build the block?

Cheers
userHeadPic Jose
2014-06-23 19:50:20 Hello rustymac,

Did you download the Block Maker software?
Here is a guide about how to make a new block, have you checked it?
http://www.mindplus.cc/?page_id=2230
userHeadPic Grey.CC