Nanoarm on a Pi 3
mikko (3145) 120 posts |
Has anyone got a Maplin robotic arm working on a Pi 3 using the BASIC code in the examples directory of the Pico distribution? I have a Maplin A37JN robot arm that works on another system but if I connect the arm to a USB port on my Pi and double click the BASIC program from the desktop I get “**** Robot arm not found ****” Is the fact I’m running this from the desktop and not via a Pico boot significant? Even those without Nanoarm experience may be able to shed some light on this code that’s “failing”… DEF PROCinit_usb As I noobily understand it, the only relevant bits to initialisation are: device$="" From a pseudocode point of view I think I see it’s trying to read a variable relating to USB via a SWI, the result should go into memory pointed at by device_buffer% and then it should iterate through that area of memory byte-by-byte, storing the ASCII equivalent of each one in device$. But I get nada. Any observations welcome. Not least on the very-magic-looking string "usb"+"$Device_00_00_00_1267_0000_-1*". (And why is it concatenated?!) |
Martin Avison (27) 1418 posts |
If the code you listed is correct, something is very wrong. |
mikko (3145) 120 posts |
Wow, textile is weird… |
mikko (3145) 120 posts |
Ah, I see the cut and paste lost some of the content. Let’s try that last bit again:
|
Andy S (2979) 504 posts |
I’ve not done any coding with USB, but I would try just printing out size% and device$ directly to see what’s in them instead of just VAL. Jon Abbott posted some USB code here https://www.riscosopen.org/forum/forums/11/topics/9026#posts-63498 to do with reading a keyboard but it might help as it looks like it checks the status a bit differently. I guess something else to check might be that if there are different revisions of the robot arm, that magic string “$Device_00_00_00_1267_0000_-1*” might need to be something different. Maybe someone can suggest how you’d work out what it should be? |
Steve Pampling (1551) 7932 posts |
The answer is probably to check the USB devices showing connected by using !USBInfo and if the robot arm shows as a different devcie ID then try a mod of the code to use the ID that is shown by USBInfo |
mikko (3145) 120 posts |
Thanks for the suggestions, guys. I’ll try out !USBInfo first as that seems a sensible place to start. |
Rick Murray (539) 13405 posts |
…and… *Show USB* …to see what the device identification variable is actually set to. |
mikko (3145) 120 posts |
In fact that was all I needed to identify a subtle differnce between the hard-coded device id and my device id: 1267_0000 vs 1267_0001. Many thanks, all. I now have a working robot arm and some code I can hack around with and learn from! |
Neil Fazakerley (464) 124 posts |
Hi Mikko. I wrote that prog on the Pico card. Those arms have had a zero device ID since they first appeared. Now it seems the makers have added a new one. I’ll have to update the Pico code to check for both IDs. Glad you got yours working now – well done for tracking down the problem. |
mikko (3145) 120 posts |
Thanks, Neil. Pico would no doubt benefit from an update but to be honest the device ID change did me a favour as it was educational to have to hunt down the problem! |
Andy S (2979) 504 posts |
That’s great you got it working. |