Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serial monitor for attiny10 #6

Open
osintes opened this issue Oct 3, 2019 · 1 comment
Open

serial monitor for attiny10 #6

osintes opened this issue Oct 3, 2019 · 1 comment

Comments

@osintes
Copy link

osintes commented Oct 3, 2019

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;
}

@wholder
Copy link
Owner

wholder commented Oct 4, 2019

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.

Wayne

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants