arduino const int analog In A 0 int
- Slides: 14
電流量測部分的arduino程式編碼(這頁是給人看的): const int analog. In = A 0; int m. Vper. Amp = 198; // 198 for 5 V int Raw. Value= 0; int ACSoffset = 2500; //回授電壓m. V double Voltage = 0; double Amps = 0; void setup(){ Serial. begin(9600); } & 66 for 30 A Module void loop(){ Raw. Value = analog. Read(analog. In); Voltage = (Raw. Value / 1024. 0) * 5000; // Gets you m. V Amps = ((Voltage - ACSoffset) / m. Vper. Amp); //霍爾元件所測量之電流量 Serial. print("Raw Value = " ); // shows pre-scaled value Serial. print(Raw. Value); Serial. print("t m. V = "); // shows the voltage measured Serial. print(Voltage, 3); // the '3' after voltage allows you to display 3 digits after decimal point Serial. print("t Amps = "); // shows the voltage measured Serial. println(Amps, 3); // the '3' after voltage allows you to display 3 digits after decimal point }
電流量測部分的arduino程式編碼(這頁是給teraterm看的 ): #define G 8 //定義一個陣列有8行 float a[G]; int temp; const int analog. In = A 0; int m. Vper. Amp = 198; // 198 for 5 V & 66 for 30 A Module int Raw. Value= 0; int ACSoffset = 2500; //回授電壓 double Voltage = 0; void doublesetup(){ Amps = 0; Serial. begin(9600); } void loop(){ Raw. Value = analog. Read(analog. In); Voltage = (Raw. Value / 1024. 0) * 5000; // Gets you m. V Amps = ((Voltage - ACSoffset) / m. Vper. Amp); //霍爾元件所測量之電流量 a[G-1] = Amps; //arduino吃5 V(浮點數),換算成 0~1023的值後,就可以反推原始的電壓值 for(int i=0; i<G; i++) //陣列取值 {Serial. print(a[i]); Serial. print("t"); } for(int i=0; i<=G-2; i++) {a[i]=a[i+1]; } Serial. print("n"); }
電壓量測部分的arduino程式編碼(這頁是給teraterm看的): #define G 8 float a[G]; int temp; //定義一個陣列有8行 void setup() { Serial. begin(9600); } void loop() { a[G-1] = 5*(float)analog. Read(A 0)/1023; //arduino吃5 V(浮點數), 換算成 0~1023的值後,就可以反推原始的電壓值 for(int i=0; i<G; i++) {Serial. print(a[i]); Serial. print("t"); } for(int i=0; i<=G-2; i++) // {a[i]=a[i+1]; } Serial. print("n"); }
- Arduino const int
- Sum0
- Char name
- V char
- Const name void
- Auto break case char
- Interface calculator public int add(int a int b) class test
- Public void drawsquare(int x, int y, int len)
- Divideint
- Int max(int x int y)
- Const int size =18 string *tbl2
- Int factorial(int n)
- Int main() int num=4
- Interface myinterface int foo(int x)
- Int main int argc char argv