I just notices something. You shouldn’t use a speed argument in hservo for the first hservo command you use. That could cause your servos to freak out intially because there is no previous position for hservo to calculate the intervening position steps.
Also in your code you make out=5 and then dec out so you should see a “5”. Not sure where you are getting a 52 in that code.
Also you are using compile time directives(#IF) instead of runtime commands(IF) with a variable. This is not going to do what you expect. Change all the #IF,#ELSE,#ENDIF to if,else and endif.
Also I recommend you chaneg the if statments from:
if inputdata = dec 2
to
if inputdata = “2”
It may work out to be the same thing but you are runing extra code to convert the number 2 into a “2” string using the dec modifier in your if then statements.
Also you don’t really need that last inputdata=0 because as soon as you jump back to main you run a serin that will wait until it receives some character which is going to change inputdata = to whatever that characters value is.
I would just like to get something cleared up about the RTS and DTR pins.
ive started to write my python application to send the data and it is not working.
I have this code to deal with those pins
ser.DTRlogic = False
ser.RTSlogic = False
is there a way i can test to make sure these pins are in the correct state?
I’m pretty sure you want to set them to reset the chip and then clear then to let it run but the simple solution is to look at the ATN pin on the module when your code gets to those lines(ie step through your C# program). On a multimeter the ATN pin should be low when the chip is running and high when in reset.
I still cant get my code to work. Its really getting frustrating cause I do not know where the problem is. I hope there’s somebody that can help with the python code.
When you open your comport are you opening it with flow control disabled? If you don’t specifically do this you may be opening it with hardware flow control which is going to mess with your RTS and DTR lines.
I suggest you disconnect the pc serial connection from the board and then connect the pc tx and rx serial lines together. Then send an ascii string and see if it is received by your program. If this works, then there maybe something going on on your board like a mismatched baud rate.