Det er, hvad jeg gjorde trin for trin:
Med:
Jeg kan se min Arduino på ID 2341:0001
Bus 002 Device 005: ID 2341:0001
Og nu med:
sudo lsusb -v -d 2341:0001
jeg kan se:
iProduct er "Arduino" og
bcdDevice er 0.01
Har du versionen 0.01 ?? Det er versionen af Arduino firmware.
Nu, jeg starter Arduino IDE og programmer denne kode:
String command = "";
char c;
int val;
int ledPin = 13; // LED connected to digital pin 13
void setup() {
pinMode(ledPin, OUTPUT); // sets the digital pin as output
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
// Check, if there is data in the receive buffer
if (Serial.available() > 0) {
// read the incoming character
c = Serial.read();
// It was a "ENTER", so decode the command
if ((c=='\n') || (c=='\r')) {
if (command == "L0") {
Serial.println("gerd's Arduino: I will turn off the LED for you!");
digitalWrite(ledPin, LOW); // sets the LED off
}
if (command == "L1") {
Serial.println("gerd's Arduino: I will turn on the LED for you!");
digitalWrite(ledPin, HIGH); // sets the LED on
}
if (command == "POT") {
val = analogRead(0); // read the input pin A0
Serial.print("gerd's Arduino: The potentiometer value is: ");
Serial.println(val,DEC);
}
// Clear the command
command = "";
}
// if it was an other character, add this to the command string
else if (command.length() < 32) {
command = command +c;
}
}
}
Jeg afslutter IDE.
Med:
jeg kan se
/dev/ttyACM0Jeg starter en Terminal-Software. Jeg tage putty
Serial Line:
/dev/ttyACM0Speed:
9600Connection Type:
SerialStarte med "Open"
I putty, jeg sender en:
L1<ENTER>Svaret er:
gerd's Arduino: I will turn off the LED for you!Jeg afslutter putty.
Nu, jeg downloader
http://www.sebulli.com/forum/danni_server.cJeg skifter til mappen af danni_server.c.
.. kompilere det med:
gcc -o danni_server danni_server.c
og starter Server med:
Server starter med:
gerd@gerd-901:~/Documents/arduino$ ./danni_server
Danni's Arduino Server started ...
IP address is: 127.0.0.1
Jeg ikke afslutter Server !!
Nu jeg starter en ny Linux Console for Client
Jeg downloader
http://www.sebulli.com/forum/danni_client.cJeg skifter til mappen af danni_server.c.
.. kompilere det med:
gcc -o danni_client danni_client.c
og starter Client med:
gerd@gerd-901:~/Documents/arduino$ ./danni_client POT
gerd's Arduino: The potentiometer value is: 558
gerd@gerd-901:~/Documents/arduino$