Forum Rule: Always post complete source code & details to reproduce any issue!
-
Connect Teensy 3.1 with scanner (USB keyboard)
Hi all.
I am new with Teensy and need help.
I need to connect USB barcode scanner to Teensy 3.1, read data, adjust the data and send via UART 1 to another device.
Teensy must be a host for scanner. I coppy and try to adjust some code:
#include <HardwareSerial.h>
Serial USB = Serial();
Serial2 Uart = Serial2();
void setup() {
USB.begin(9600);
Uart.begin(38400);
}
void loop() {
int incomingByte;
if (USB.available() > 0)
{
incomingByte = USB.read();
USB.print("USB received: ");
USB.println(incomingByte, DEC);
Uart.print("USB received:");
Uart.println(incomingByte, DEC);
}
}
why it doesn't recognize what is "Serial"?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules