I have connected mc to a pc using USB. I need data on hyperterminal through serial to USB connection, hence I connected TX, RX and gnd pins of the Leonardo to the rs232 pins and one other side of rs232 to USB to pc. However, the data is still transmitting on serial monitor, but not on hyperterminal.
int count = 0;
void setup() {
Serial.begin(9600);
pinMode(3,INPUT); // This is the pin to which we have connected the button
attachInterrupt(0, IRsensor, CHANGE);
}
void loop() {
if (Serial.available()) {
/* read the most recent byte */
/*ECHO the value that was read, back to the serial port. */
Serial.write(count);
}
}
void IRsensor() {
if(digitalRead(3) == 1) {
count++;
Serial.println(count);
}
}