so for a project i am currently working on, i need to give input to the serial port on the bot board 2.
based on the input i need to do different things. seams simple but for some reason my code wont work.
Just use PowerPod to generate a 'pro program for you, one that uses com to control it. Then study the code generated, you’ll see the serin and serout code in use.
the code below cycles an LED
serout S_OUT, i9600, "Flash LED"] ;
LED_D2 con P2 ; LED C
loop
low LED_D2 ; LED C "heart beat" ON
pause 500 ; mS
high LED_D2 ; LED C "heart beat" OFF
goto loop
I’m jumping in the middle here, but try figuring the serial inputs to do something simpler like turn on an LED. Then we can work on the servo stuff. It might be easier to use pulsouts. For the Bot Board II with Atom Pro to turn on and off the LEDs do this.
low 12 'turn red LED A on
input 12 'turn red LED A off
low 13 'turn green LED B on
input 13 'turn green LED B off
low 14 'turn yellow LED C on
input 14 'turn yellow LED C off
Break the problem up. First get an echo of what you’re sending back to your terminal emulator program. the ‘2’ you’re looking for can be confusing; are you sending an ASCII character ‘2’? or binary value 02H?
After you get an echo back and see what you’re receiving (buad rate conflicts?), then you can expand the program and get the conditional working, and turn on/off some LEDs
Once you get the LEDs to respond properly, then work on sending servo commands out.
Alan KM6VV
The eventual goal is that I will have a python program send the data but I will Wright this once i get the basic code done. I am sending an ASCII character not a hex value.
when i was trying this earlier, i keep getting “5” as a response, even with the serout commented, it will still sending a 5, what does that mean, what is this number.
Your C# terminal program is probably holding the AtomPro module in reset. The RTS(or DTR) pins are connected to the reset pin of the module when in the bot board. Most terminal progr4am will hold these pins in the wrong state(they need to be cleared). Also you should use no flow control in your terminal comport settings. For testing purposes you should be using the builtin terminal windows in Basic Micro Studio. Those already set the RTS and DTR pins correctly when connecting.
tried with the buit in terminal and got the same result, as soon as i hit enter, its displays a 5 in the next line so im not sure if it is sending 2 of 52?