Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define LM351PIN 0 // PORTC0 / D14 / Fisik pin23 328p
- #define LM352PIN 1 // PORTC1 / D15 / Fisik pin24 328p
- #define REPLYSIZE 100
- char reply[REPLYSIZE];
- void setup() {
- Serial.begin(9600);
- Serial.println();
- analogReference(EXTERNAL);
- };
- void loop() {
- memset(reply,0,REPLYSIZE);
- strcat(reply,"Temperatur");
- Suhu(reply);
- Serial.println(reply);
- delay(3000);
- };
- void Suhu(char *buff) {
- static float constC = 4.096*10.0;
- int analog1Val = 0;
- int analog2Val = 0;
- float tempC = 0.0;
- char buffer[5];
- strcat(buff," TempA:");
- for(byte i=0;i<10;i++) {
- analog1Val += analogRead(LM351PIN);
- analog2Val += analogRead(LM352PIN);
- delay(5);
- }
- tempC = analog1Val/constC;
- dtostrf(tempC,5,2,buffer);
- strcat(buff,buffer);
- strcat(buff," TempB:");
- tempC = analog2Val/constC;
- dtostrf(tempC,5,2,buffer);
- strcat(buff,buffer);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement