1234567891011121314151617181920212223242526272829303132333435 |
- int temp=0;
- float sum =0;
- float AMPS_SCALE =0;
- float amps=0;
- void setup()
- {
- Serial.begin(9600);
- }
- void loop()
- {
- for(int i = 0; i < 100; i++)
- {
- temp=analogRead(A1);
- sum += temp;
- delayMicroseconds(50);
- }
- sum=sum/100;
-
-
-
- AMPS_SCALE= 0.00488/ 0.185;
- amps = AMPS_SCALE* sum - 13.51;
-
- Serial.print(amps);
- Serial.println("A");
- delay(500);
- }
-
-
|