Created
September 12, 2017 23:27
-
-
Save dorukgezici/1e39786667038c29ec7798abc0767489 to your computer and use it in GitHub Desktop.
Sending sensor data to RX output using Software Serial.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <arduino.h> | |
#include <SoftwareSerial.h> | |
#define TEMP_PIN A0 | |
float temp; | |
SoftwareSerial mySerial(D6, D7); // RX, TX | |
void setup() { | |
Serial.begin(115200); // tty.wchusbserial14130 | |
mySerial.begin(4800); // tty.wchusbserial14110 | |
} | |
void loop() { | |
temp = analogRead(TEMP_PIN); | |
temp = temp * (3*100)/1024; // (Voltage*100)/1024 | |
Serial.print("TEMPERATURE = "); | |
Serial.print(temp); | |
Serial.println(" C"); | |
mySerial.println(temp); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment