Aber bitte: Das leuchtende Modul auf dem Steckbrett ist ein Bluetooth-/Seriell-Umsetzer. Die auf dem Handy sichtbare App ist ein Bluetooth-Terminal mit konfigurierbaren Buttons. Bei Senden eines speziellen Zeichens gibt er die ermittelte Spannung an Analog-Pin 0 auf die Konsole aus.2Alf20658 hat geschrieben: Auszulesen dann mit Smartphone ? Das wäre der Hammer.
Code: Alles auswählen
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); //RX, TX - Bluetooth-Ausgabe
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
int ack;
int sensorValue = 0; // Variable initialisieren
void setup()
{
Serial.begin(9600);
Serial.println("Startup");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println("Leviate boot ..."); // - Bluetooth-Ausgabe
}
void loop() // run over and over
{
// read the analog in value:
sensorValue = analogRead(analogInPin); //Lese PIN 0
// //Reichweitentest Bluetooth
// if (mySerial.read()=='t'){ //
// Serial.println("Test1");
// mySerial.print("Ack ");
// mySerial.print(ack);
// mySerial.println("");
// ack+=1;
// }
//Analog PIN 0
if (mySerial.read()=='v'){ //
Serial.println("Test2");
mySerial.print("Analog 0: ");
mySerial.print(sensorValue*5/1023);
mySerial.println("V");
}
}Dirk