Sistem Monitoring Kekeruhan Dengan Metode Pendeteksi Warna Pada Air Dengan Sms Gateway

Loading.... (view fulltext now)

Loading....

Loading....

Loading....

Loading....

Teks penuh

(1)

Lampiran

PROGRAM LENGKAP

//Program transmiter

#include <LiquidCrystal.h>

#include <VirtualWire.h>

#include <String.h>

LiquidCrystal lcd(8, 6, 5,9, 10, 4);

int data=0;

float keruh;

char kirim;

void setup() {

lcd.begin(16, 2);

vw_set_tx_pin(12);

vw_set_ptt_inverted(true); // Required for DR3100

vw_setup(200); // Bits per sec

}

void loop() {

lcd.clear();

data=analogRead(0);

lcd.setCursor(0,0);

lcd.print("kekeruhan air");

(2)

lcd.print("air = ");

data=(data-320)/5;

if (data<0){data=0;}

if (data>100){data=100;}

if (data>13000){data=0;}

lcd.print(data);

lcd.print(" %");

if (data>75){kirim=0;}

else {kirim=1;}

vw_send((uint8_t *)kirim, 1);

vw_wait_tx();

delay(100);

}

//program receiver

#include <VirtualWire.h>

const int led_pin = 13;

const int buzzer_pin = 3;

(3)

void setup()

{

// delay(1000);

Serial.begin(9600); // Debugging only

Serial.println("setup");

// Initialise the IO and ISR

vw_set_rx_pin(A5);

vw_set_ptt_inverted(true); // Required for DR3100

vw_setup(200); // Bits per sec

vw_rx_start(); // Start the receiver PLL running

pinMode(led_pin, OUTPUT);

pinMode(buzzer_pin, OUTPUT);

}

void loop()

{

uint8_t buf[VW_MAX_MESSAGE_LEN];

uint8_t buflen = VW_MAX_MESSAGE_LEN;

if (vw_get_message(buf, &buflen)) // Non-blocking

{

int i;

(4)

{

Serial.print(buf[i], DEC);

}

Serial.println();

}

if

(buf[0]==176){digitalWrite(led_pin,HIGH);digitalWrite(b uzzer_pin,HIGH);}

else

{digitalWrite(led_pin,LOW);digitalWrite(buzzer_pin,LOW)

;}

(5)

Figur

Memperbarui...

Referensi

Memperbarui...