hi, i'm thomas. i have a little problem
my board is a :Arduino UNO Rev3
my program won't Load, i'm trying to program it as a keyboard HID, before the programmation of the chip as HID, i must program the arduino, and this is it:
#include <SoftwareSerial.h>
uint8_t buf[8] = { 0 }; /* Keyboard report buffer */
#define KEY_LEFT_CTRL 0x01
#define KEY_LEFT_SHIFT 0x02
#define KEY_RIGHT_CTRL 0x10
#define KEY_RIGHT_SHIFT 0x20
void setup()
{
Serial.begin(9600); //connection between chips
delay(200);
pinMode(8,INPUT);
pinMode(9,INPUT);
pinMode(10,INPUT);
pinMode(11,INPUT);
pinMode(12,INPUT);
pinMode(13,INPUT);
pinMode(7,OUTPUT);
}
void type(char *str)
{
char *chp = str;
delay(100);
while (*chp) {
if ((*chp >= 'a') && (*chp <= 'z')) {
buf[2] = *chp - 'a' + 4; //Converts from char to usb code from HUT1_11.pdf
} else if ((*chp >= 'A') && (*chp <= 'Z')) {
buf[0] = KEY_LEFT_SHIFT; /* Caps */
buf[2] = *chp - 'A' + 4; //Converts from char to usb code from HUT1_11.pdf
} else if ((*chp >= '0') && (*chp <= '9')) {
buf[2] = *chp - '0' + 30; //Converts from char to usb code from HUT1_11.pdf
} else {
switch (*chp) {
case '1':
buf[2] = 0x04; // a
break;
case '2':
buf[2] = 0x26; // w
break;
case '4':
buf[2] = 0x22; // s
break;
case '8':
buf[2] = 0x07; // d
break;
case '16':
buf[2] = 0x44; // space
break;
case '32':
buf[2] = 0x04; // q
break;
default:
/* Character not handled. To do: add rest of chars from HUT1_11.pdf */
//buf[2] = 0x37; // Period
break;
}
}
Serial.write(buf, 7); // Send keypress
buf[0] = 0;
buf[2] = 0;
Serial.write(buf, 7); // Release key
chp++;
}
}
void loop()
{
char carattere[6];
int i;
carattere[0]=digitalRead(8);
carattere[1]=digitalRead(9);
carattere[2]=digitalRead(10);
carattere[3]=digitalRead(11);
carattere[4]=digitalRead(12);
carattere[5]=digitalRead(13);
type(carattere);
}
but it give to me this problem:
Arduino: 1.6.3 (Windows 7), Плата"Arduino Uno"
Sketch uses 2 734 bytes (8%) of program storage space. Maximum is 32 256 bytes.
Global variables use 258 bytes (12%) of dynamic memory, leaving 1 790 bytes for local variables. Maximum is 2 048 bytes.
avrdude: ser_open(): can't open device "\\.\COM1": ?? ??????? ????? ????????? ????.
???????? ???????? ?? ?????. ??? ?????????? ????, ?????? http://www.arduino.cc/en/Guide/Troubleshooting#upload .
Board at COM1 is not available
Это сообщение будет содержать больше информации чем
"Отображать вывод во время компиляции"
включено в Файл > Настройки
can anyone help me?