You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
int sensitive = 185; // สำหรับ 5A
// int sensitive = 100; // สำหรับ 20A
// int sensitive = 66; // สำหรับ 30A
int offset = 2525; // ค่าเริ่มต้น 2500 ปรับค่าตรงนี้เพื่อให้ค่ายังไม่มีโหลดเป็น 0.00
void setup() {
mySerial.begin(9600);
}
void loop() {
double c = getCA();
mySerial.print(c);
delay(1000);
}
// หาค่ากระแสเฉลี่ย
double getCA() {
int count = 200;
double sum = 0;
for (int i = 0; i < count; i++) {
sum += getC();
}
double val = sum / count;
return val;
}
// อ่านค่ากระแส
double getC() {
int a = analogRead(A0);
double v = (a / 1024.0) * 5000;
double c = (v - offset) / sensitive;
return c;
}
The text was updated successfully, but these errors were encountered:
Thanks for the suggestion. I have plans to support some type of monitoring, but it's still in development. You might also want to check another project of mine, "AVR/Arduino Hardware Debugger on the Cheap (part 3)" which can use an Arduino to debug an ATTiny, such as an ATTiny85. I'm hoping to eventually support something like this in ATTiny10IDE, but there are some complex issues I have to sort our first.
hello , thank for your proyect , I request for monitoring serial , this featured as debugging , thnak
like...
#pragma clock 8000000
#include "Arduino.h"
//#include "Monitor.h"
#include "SoftwareSerial.h"
SoftwareSerial mySerial(3);
int sensitive = 185; // สำหรับ 5A
// int sensitive = 100; // สำหรับ 20A
// int sensitive = 66; // สำหรับ 30A
int offset = 2525; // ค่าเริ่มต้น 2500 ปรับค่าตรงนี้เพื่อให้ค่ายังไม่มีโหลดเป็น 0.00
void setup() {
mySerial.begin(9600);
}
void loop() {
double c = getCA();
mySerial.print(c);
delay(1000);
}
// หาค่ากระแสเฉลี่ย
double getCA() {
int count = 200;
double sum = 0;
for (int i = 0; i < count; i++) {
sum += getC();
}
double val = sum / count;
return val;
}
// อ่านค่ากระแส
double getC() {
int a = analogRead(A0);
double v = (a / 1024.0) * 5000;
double c = (v - offset) / sensitive;
return c;
}
The text was updated successfully, but these errors were encountered: