Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boolean firstRun=true;
- double tip=0;
- double last=0;
- double realVoltage=0;
- void setup(){
- Serial.begin(9600);
- Serial.println("Serial Started w00t");
- last=analogRead(0);
- }
- void loop(){
- tip=analogRead(0);
- if(tip>50){
- Serial.print("Incoming Voltage is ");
- Serial.println(tip);
- last=last+((tip-last)/5);
- Serial.print("avg voltage is ");
- Serial.println(last);
- realVoltage = ((last*6.83593)/1000); // 7k/5k*5000mV/1024
- Serial.print("Real voltage: ");
- Serial.println(realVoltage);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement