From: Dan Lesutis on 16 Apr 2010 22:01 Hey Guys, I am working on a serial communications project. Trying to communicate with this device. http://www.pololu.com/catalog/product/1350 Link for user manual http://www.pololu.com/docs/pdf/0J40/maestro.pdf I want to write three bytes out. 255 0 245. Below is from the help manual For example, if we wanted to set the target of servo 0 to its (configurable) neutral position, we could send the following byte sequence: in hex: 0xFF, 0x00, 0x7F in decimal: 255, 0, 127 s=serial('com3') fopen(s) fwrite(s,[255 0 245],'uint8') fclose also tried s=serial('com3') fopen(s) fwrite(s,[255],'uint8') fwrite(s,[0],'uint8') fwrite(s,[245],'uint8') fclose My questions How do I structure the data so it sends out the three data bytes? Do I need brackets? Should I use int8 or uint8? Does fwrite tack on a termination char like fprintf? I've used this help file. http://cnx.org/content/m10821/latest/ The matlab help file on fwrite doesn't give any clear examples of writing out multiple data bytes. Any help would be greatly appreciated Thanks, Dan
From: Dan Lesutis on 16 Apr 2010 22:49 I am also using this serial monitor program http://www.serial-port-monitor.com/ The monitors sees matlab outputting my three bytes with the correct decimal values. It also shows some funky text chars after my data -Dan
|
Pages: 1 Prev: Forcing display output from cellarray Next: counting object |