NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Support Forum » Using serial in python problems
June 14, 2011 by awkwardsaw |
I'm having trouble using serial for this project, this is my first "solo" project, so i'm pretty much doing this blindly :p python:
c:
What it does is python gets info from a pipe, and sends either a 't' or 'f' for 3 different variables via serial to the MCU. Then the mcu turns on leds depending on which variable is 't' or 'f'(also debugs them to the lcd). The problem is that the mcu doesn't read the characters correctly, so it doesn't turn on the leds. Sorry that I don't know how to explain it better, hopefully the code makes more sence :) |
---|---|
June 14, 2011 by Noter |
I don't know python but maybe a \n is needed in the scanf_P like PSTR("%c\n") ? Also, when you compare variables in c, two equal signs are used like this
|
June 15, 2011 by hevans (NerdKits Staff) |
Hi awkardsaw, It looks like you are trying to do a whole lot there, and its hard to tell where the problem is. I suggest you simplify so you can solve the problems one at a time. Like Noter mentioned you you don't have the equality quite right, you want to use == to check equality. Another issue I see is that you are printing chars using lcd_write_data, which is a way to send commands to the LCD (like clear, and set position), not characters to write to the LCD. Use lcd_write_byte for that instead. lcd_write_string doesn't work either because it expects the string to be in program memory, which your char isn't. Humberto |
June 15, 2011 by awkwardsaw |
Thanks, that explains why there was weird charachters on the display. I'll play around with it when i get the chance |
Please log in to post a reply.
Did you know that our customers love us? Learn more...
|