Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
00001 #include "mbed.h" 00002 00003 AnalogIn analog_value(A1); //object คือ analog_value 00004 00005 BusOut myleds(D2,D3,D4,D5); 00006 BusOut myleda(D6,D7,D8,D9); 00007 Serial pc(D1, D0); 00008 00009 00010 int main() { 00011 float meas; 00012 int decimal; //หลักทศนิยม 00013 int unit; //หลักหน่วย 00014 00015 while(1) { 00016 meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0) แปลงแรงดันจาก 0-3.3 เป็นดิจิตอล 0.0-1.0 00017 //meas = analog_value.read(); 00018 meas = meas * 33; // Change the value to be in the 0 to 3300 range 00019 decimal = meas; 00020 unit = meas; 00021 decimal = decimal % 10; 00022 unit = unit-decimal; 00023 00024 00025 unit = unit % 100; 00026 unit = unit / 10; 00027 myleds = decimal; 00028 myleda = unit; 00029 pc.printf("%d",unit); 00030 pc.printf("%d",decimal); 00031 pc.printf("\n"); 00032 wait(0.1); 00033 00034 } 00035 }
Generated on Tue Jul 12 2022 21:31:59 by
1.7.2