Bluetooth HC-06. Arduino. Send. Receive. Send text file. Multitouch. Image

22.- JoyStick in Arduino sends values. Move a ball.

p9A0_bluetooth_laberinto.aia (115.7 KB)

JoyStick Arduino.

// Juan A. Villalpando
// http://kio4.com/appinventor/9A0_Resumen_Bluetooth.htm

int x;
int y;
int c;
String datos;

void setup() {
 Serial.begin(9600);
 pinMode(2,INPUT_PULLUP);
}

void loop() {
  x = analogRead(A0);
  y = analogRead(A1);
  if (digitalRead(2) == HIGH){c=0;} else {c=1;}
  datos = (String) x + "," + (String) y + "," + (String) c;
  Serial.println(datos);
  delay(100);
}

Variables x,y: Ball.MoveTo and DrawLine.
Variable c: Canvas.Clear (when press JoyStick)