Snap4Arduino
Snap4Arduino copied to clipboard
Distance sensor not working in Chrome
Hi team,
I have observed that using the Chrome extension (last version 1.2.7) the distance sensor does not showing the value. Using the same setup (firmata code/hardware/block) is working fine in the desktop app version (1.2.7).
I have started to work again on an old project, where the firmata version is at least 3 years old. Do you think this may be the issue? I'm thinking to this, because I have also encountered a lots of issue with BT connectivity (HC-06 with arduino uno), either with desktop application or Chrome version. The only workaround for Chrome extension to connect with success in 90% of the cases was to start using following steps:
- Open Chrome Extension
- Refresh the Snap4Arduino connector
- Connect to the available port
If using desktop application, the only way to make the BT connectivity working 100% of times, is to press the reset button on arduino uno shield while the Snap4arduino is displaying the message "Connecting to port x... "
I have absolute no problem if using and old version (from 2015). And once I'm connected, there is no other connectivity issues, and I can stay connected for hours.
I don't want to mix the topics, if you believe it make sense to open a new topic for BT connection, I will do that. I put it here because I believe the firmata version could be the reason for both.
Thanks, Adrian
Hi @adryannn.
Different issues here...
-
About ChromeOs app. This is a very limited Snap4Arduino edition. We keep it because many people ask for it, but it has some limitations. All the javascript functions (as many Snap! libs) are KO, because Chrome does not allow these features.
-
You can use Chromium plugin, using Snap4Arduino online or a downloaded version and using this plugin to connect to the boards. In this case, javascript functions are running ok, but we need to check the code to know if this "ultrasound" library is ok for current firmata version. Anyway, I recommend you to use SA5Firmata. The blocks are in the libraries, and you can use the "ping" block to get the distance.
-
About BT connections. We are using BT with the current version without problems but yes, sometimes (with older and newer versions) some people report problems (the need of reseting you've said) in some cases (depening the OS they are working or other hardware issues).
But one question, you have said that you have no problems using an old Snap4Arduino version. Are you using the same PC and the same hardware (the same Arduino board with the same connections (and the same BT module) and the same firmata inside)?? If the answer is yes, I ask you which is that old version to check it... but I guess the problem is other place (maybe the OS behavior).
Joan
Hi Joan,
Thanks for the quick feedback.
I'm using Chromium plugin with Snap4Arduino online, not ChromeOs app. I have same hardware and firmata/code, and only in the online version the Distance sensor is not working.
inside firmata code is very simple: Ultrasonic ultrasonic(13,12); // (Trig PIN,Echo PIN) //for Ultrasonic - define pins ... case 0x09: //For Ultrasonic - Get the distance Serial.write(START_SYSEX); Serial.write(STRING_DATA); pinMode(13,OUTPUT); pinMode(12,INPUT); Serial.println(ultrasonic.Ranging(CM)); //ultrasonic.Ranging(CM) Serial.write(END_SYSEX); break;
the screenshot with Snap block is already uploaded in the previous comment.
Regarding BT, just to keep same laptop/OS, I have downloaded latest version and test it again: Same hardware (HC-06 with arduino nano) Lenovo t61 - Windows 7 32bit
old version 1.0.7 beta - I can connect without any issue new version 1.2.7 - I can connect only if I press reset button, while is Snap4arduino is connecting to bluetooth port...
Anyway, I will try with the SA5firmata and let you know the results.
PS: I'm using other software to program arduino, which can be installed on mobile, and I have no problem with BT connection, but I hope the connection will become stable in Snap4arduino as I think this has more potential as is highly customizable and I can add my own blocks.
Thanks, Adrian
Hi Adrian, Thanks. Your feedback with SA5Firmata will be appreciated.
That 1.0.7 beta version is too old! And yes, different changes over firmata... Then, two things to consider:
- I see the web version (with the chromium plugin) does not accept extra "sysex" definitions. Then, you must use SA5 blocks if you want to work with this web version.
- And for the desktop use and the BT problems, you can test to change your firmware. I guess your code (the sysex definition) is written inside and old firmata. You can use a fresh StandardFirmata and add the code inside.
Anyway, I hope SA5 fix both issues.
Joan