-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathATTmain.ino
More file actions
43 lines (38 loc) · 1.06 KB
/
ATTmain.ino
File metadata and controls
43 lines (38 loc) · 1.06 KB
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
// ATtiny85 datalogger
// GBPintarelli
// 07/08/2016
// Last info: Funciona muito bem!
#include<SoftwareSerial.h>
int value=0;
int pinadc = 3; // HW pin 2 (or analog input 1)
int pinleddebug = 4; // HW pin 7
const byte rxpin = 0;
const byte txpin = 1;
SoftwareSerial BTSerial(rxpin,txpin); // Rx = 0 e Tx = 1
void setup() {
BTSerial.begin(9600);
delay(2000);
BTSerial.println("HI!");
/*
Bluetooth.println("AT"); // just a check
delay(100);
Bluetooth.print("AT+NAMEModulo");
delay(100);
Bluetooth.println("AT+ROLE0"); // st up as Master
delay(100);
Bluetooth.println("AT+BAUD4");
delay(100);
Bluetooth.println("AT+PIN101010");
delay(100);
Bluetooth.println("AT+RESET"); // reseta para fazer valer as novas configs*/
}
void loop() {
value=analogRead(pinadc);
//value = 5*value/1023;
BTSerial.print(value,DEC);
BTSerial.write(";");
digitalWrite(pinleddebug, HIGH); // sets the LED on
delay(500); // waits for a second
digitalWrite(pinleddebug, LOW); // sets the LED off
delay(500); // waits for a second
}