forked from MoududHassan/AndroidWithArduino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArduino code
44 lines (38 loc) · 770 Bytes
/
Arduino code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <Max3421e.h>
#include <UsbHost.h>
#include <AndroidAccessory.h>
#include <LiquidCrystal.h>
#define LED_PIN 13
AndroidAccessory acc("Manufacturer",
"Model",
"Description",
"1.0",
"http://yoursite.com",
"0000000012345678");
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
// set communiation speed
Serial.begin(115200);
Serial.print("\r\nStart");
Serial.flush();
pinMode(LED_PIN, OUTPUT);
acc.begin();
lcd.begin(16, 2);
lcd.print("Android..");
}
void loop()
{
byte msg[1];
if (acc.isConnected()) {
if(acc.available()){
lcd.clear();
}
while(acc.available() > 0) {
lcd.write(acc.read());
}
lcd.setCursor(0,1);
lcd.cursor();
}
delay(100);
}