31 lines
555 B
Arduino
31 lines
555 B
Arduino
|
#include <SoftwareSerial.h>
|
||
|
// HC - 06 ARDUINO
|
||
|
// VCC - 5V
|
||
|
// GND - GND
|
||
|
// TXD - 10
|
||
|
// RXD - 11
|
||
|
SoftwareSerial miBT(10,11);
|
||
|
byte pepe;
|
||
|
|
||
|
void setup() {
|
||
|
Serial.begin(9600);
|
||
|
Serial.print("Listo");
|
||
|
miBT.begin(9600);
|
||
|
pepe = map(analogRead(A0), 0 , 1023, 0, 99);
|
||
|
}
|
||
|
|
||
|
void loop() {
|
||
|
|
||
|
if(miBT.available()) {
|
||
|
Serial.write(miBT.read()); //lee BT y envia a Arduino
|
||
|
}
|
||
|
|
||
|
if(Serial.available()) {
|
||
|
miBT.write(map(analogRead(A0), 0 , 1023, 0, 99)); // lee Arduino y envia a BT
|
||
|
miBT.write(pepe);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|