Serial Output freezes. TX light stays on.


hi,
 arduino noob here.   i've been researching few days no luck, apologize if answer here , can't find it.  

short background.  i'm building system stops operator using compressed air assembly press in wrong order.  just few positional dip switches make sure don't forget did last.  and power tail ii cut off power machine if out of order.

arduino uno rev. 3  

the serial output on uno freezes after anywhere 30 seconds 3 hours of usage.  the tx light stays lit , serial output stops feeding serial monitor in ide.  the uno continues read sensors , operates program accordingly.  i assumed it's power related tried running extension cord uno , computer didn't improve results @ all.    it seems related machine firing (even though it's air powered piston).  i want rule out coding errors before beat head against wall chasing down ground issues on machine.  
the serial output 3 numbers interpreted processing.org

code: [select]
#define button  8
#define switch 10
#define connect1 5
#define connect2 8
#define vertconnect 12
int marker = 1;
boolean pushstate = false;
boolean lastpush = false;
boolean lastswitch = low;

void setup()
{
pinsinit();
       serial.begin(9600);
 
}  

void loop()
{
       int pos1 = digitalread(connect1);
       int pos2 = digitalread(connect2);
       int vert = digitalread(vertconnect);
       if(pos1 == 1){
         serial.print(f("1"));
         if(lastswitch != high)  {
           lastswitch = high;
         }
       }
       else if(pos2 == 1) {
         serial.print(f("2"));
         if(lastswitch != high)  {
           lastswitch = high;
         }
       }
       else {
         serial.print(f("0"));
         if(lastswitch != low)  {
           digitalwrite(switch, low);
           lastswitch = low;
         }
       }
       if(vert == 1) {
         pushstate = true;
         serial.print(f(" 1"));
       }
       else pushstate = false;
       
       if(lastpush != pushstate && pushstate == true) {
         if(marker == 1) marker = 2;
         else marker = 1;
       }
       lastpush = pushstate;
       
       if(marker == 1) {
          if(pos1 == 1) {
            serial.println(f(" 1."));
            digitalwrite(switch, high);
          }else {
            serial.println(f(" 2."));
            digitalwrite(switch, low);
          }
       } else if(marker == 2){
           if(pos2 == 1) {
            serial.println(f(" 3."));
             digitalwrite(switch, high);
           } else {
            serial.println(f(" 4."));
             digitalwrite(switch, low);
           }
       } else {
         marker = 1;
         digitalwrite(switch, low);
       }
       delay(500);
}
void pinsinit()
{
       pinmode(connect1, input);
       pinmode(connect2, input);
       pinmode(vertconnect, input);
       pinmode(switch, output);
}



thanks wonderful product, , help!

follow question.  if sensors have direct contact machine being fired, need ground arduino circuit machine(110v)?  

i didn't follow conditional logic in sketch didn't see cause stability problems.


the tx light stays lit ...


i see symptoms when uno writes serial port , corresponding virtual serial port in pc not open. makes me wonder whether application supposed reading virtual serial port has failed, or usb drivers have somehow failed. aren't using gobetwino, i've had similar problems working ok few hours , no apparent reason stopped receiving serial input , arduino acted if serial port closed. try running sketch realterm reading , logging input , see if made difference. i've never seen serial port problems realterm. not sure solution if symptoms can't reproduced realterm, @ least confirms you're looking @ client side issue.


Arduino Forum > Using Arduino > Programming Questions > Serial Output freezes. TX light stays on.


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62