It has been a while since I post anything here and it feels great when I have something to share :)- Geeky content warning~
So Brian and I are both very much into playful invention and we’ve been working together on various projects. Recently I helped him ordered 30 Arduinos and some neopixel ring from mainland China. The Arduino board is a clone so it is not using the USB-Serial chip (FDTI compatible) comes with the original Arduino. It uses something called CH340 and the driver could be found here.
Brian is using LightLogo as the platform for students to apply their logo code on some tangible hardwares. The package from the site doesn’t work with the clone, so what’s wrong?
- When using the assembler.jar in the lightlogo-vm directory, the TX/RX light on the clone arduino doesn’t work, which suggests that the code cannot be loaded to the board.
- When running the LightLogo.jar in the lightlogo directory, an error message “device not found” was shown.
- I tried to open the sourcecode using Eclipse (as it is java based), gave me a lot of insight on how LightLogo was written (a bunch of LContext/Function and parameters…), the file that I spent most time on was MacSerialHandler.java, which extends the SerialHandler.java with a function called “usbInit”, but it is an empty method!
- In Arduino/Processing when I tried to access the serial port I need to specify which port I’m using, in Linux/Mac this is done by referring to a file/device path.
- For the original Arduino UNO, according to the Arduino environment (Tools-Ports), the original board has a port name called (cu.usbserial1411), and the “clone” has a port name called “cu.wchusbserial1410”. There are few other ports that we can find in the directory /dev/cu.*
- Where in the LightLogo code does it specify the port???
After looking through all the .java file with no luck, I started looking at the assembler.logo file, which is the script written in the logo language, and bingo!
to find-mac-port dolist [i files "/dev][if member? "cu.usbmodem :i [output :i]] dolist [i files "/dev][if member? "cu.usbserial :i [output :i]] output " end
Obviously these few lines of code are they key! It is trying to find a port called “cu.usbserial” instead of “cu.wchusbserial”, so “naturally” I modified the code to
to find-mac-port dolist [i files "/dev][if member? "cu.wchusberial :i [output :i]] dolist [i files "/dev][if member? "cu.usbmodem :i [output :i]] dolist [i files "/dev][if member? "cu.usbserial :i [output :i]] output " end
And it worked!
So in order for the LightLogo.jar to run, modify the same code (*Update [11/21/2016]: I should have mentioned the compiler.logo has be changed as well in order for it to work, thanks @briansmith and @tylerbeatty!) and you can download the logo script to Arduino 🙂
Happy problem solving!
*Brian if you read this message can you send me some screen capture/picture of the ring so this post won’t be that dry? Thanks!