Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
testbluthoot [2017/02/16 04:10]
leo created
testbluthoot [2019/07/16 19:43] (current)
Line 1: Line 1:
-<codedoc code:c> +[[examplescode|Regresa a codigos]] 
-//Coche fantastico con 6 LEDS+<sxh c> 
 +/
 + * Prueba del enlace bluetooth. 
 + * Usando Software serial library 
 +*/
  
-#define ROJO1        2 +#include <​SoftwareSerial.h>​
-#define AMARILLO1 ​   3 +
-#define VERDE1 ​      4 +
-#define ROJO2        5 +
-#define AMARILLO2 ​   6 +
-#define VERDE2 ​      7+
  
-int i;+SoftwareSerial mySerial(11,​ 12)// RX, TX
  
 void setup() { void setup() {
-  ​pinMode(ROJO1,​OUTPUT);​ +  ​// Open serial communications and wait for port to open: 
-  ​pinMode(AMARILLO1,​OUTPUT); +  ​Serial.begin(9600); 
-  ​pinMode(VERDE1,​OUTPUT); +  ​while (!Serial
-  ​pinMode(ROJO2,​OUTPUT); +    ​// wait for serial port to connect. Needed for native USB port only 
-  ​pinMode(AMARILLO2,​OUTPUT); +  ​
-  ​pinMode(VERDE2,OUTPUT);+ 
 + 
 +  Serial.println("Hola buenas noches!"​); 
 + 
 +  ​// set the data rate for the SoftwareSerial port 
 +  mySerial.begin(9600); 
 +  ​mySerial.println("Holamundo?"​);
 } }
  
-void loop() { +void loop() { // run over and over 
-  ​//Recorre luces +  ​if (mySerial.available()) { 
-  ​for(i=2;​i<​8;​i++){ +    ​Serial.write(mySerial.read());
-    ​digitalWrite(i,HIGH); +
-    delay(100)+
-    digitalWrite(i,​LOW);​ +
-    delay(50);+
   }   }
-  ​//Recorre luces reversa +  ​if (Serial.available()) { 
-  for(i=6;​i>​2;​i--){ +    ​mySerial.write(Serial.read());
-    ​digitalWrite(i,HIGH); +
-    delay(100)+
-    digitalWrite(i,​LOW);​ +
-    delay(50);+
   }   }
 } }
- +</sxh>
-</codedoc> +
- +
- +
- +
- +
- +
- +
- +
- +
- +