كتاب مميز يساعدك في البدء بتعلم الأردوينو من خلال الشرح المبسط و الرسوم التوضيحية و النصائح لحل بعض المشكلات
للتحميل المباشر here
للتحميل المباشر here
# include <SoftwareSerial.h> SoftwareSerial bt_serial(2, 3); String peticion = ""; char c = ' '; void setup() { pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); digitalWrite(4, LOW); digitalWrite(5, LOW); digitalWrite(6, LOW); digitalWrite(7, LOW); digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, LOW); bt_serial.begin(38400); bt_serial.setTimeout(5); Serial.begin(9600); } void loop() { if (bt_serial.available() > 0) { while (bt_serial.available() > 0) { c = bt_serial.read(); peticion += c; } Serial.println(peticion); if (peticion == "act1on") { digitalWrite(4, HIGH); Serial.println("Uno on"); } if (peticion == "act1off") digitalWrite(4, LOW); if (peticion == "act2on") digitalWrite(5, HIGH); if (peticion == "act2off") digitalWrite(5, LOW); if (peticion == "act3on") digitalWrite(6, HIGH); if (peticion == "act3off") digitalWrite(6, LOW); if (peticion == "act4on") digitalWrite(7, HIGH); if (peticion == "act4off") digitalWrite(7, LOW); if (peticion == "act5on") digitalWrite(8, HIGH); if (peticion == "act5off") digitalWrite(8, LOW); if (peticion == "act6on") digitalWrite(9, HIGH); if (peticion == "act6off") digitalWrite(9, LOW); if (peticion == "act7on") digitalWrite(10, HIGH); if (peticion == "act7off") digitalWrite(10, LOW); if (peticion == "act8on") digitalWrite(11, HIGH); if (peticion == "act8off") digitalWrite(11, LOW); } peticion = ""; c = ' '; }