Beruflich Dokumente
Kultur Dokumente
មេម ៀនទី ៣
ប ៊ូតុង
BUTTONS
I-និយេន័យ
ប៊ូ តុងក៏ ជារបមេទកុងតាក់េួយដែ ដតវាមានស្ថានភាពខុ សពី កុងតាក់ ធេមតាបនតិច មោយមគតរេូវ
II-និេិតស
ត ញ្ញា និង ប
៊ូ
III-មសមា៉ា ប៉ា៊ូលកេមប៊ូតុង
1
National Technical Training Institute Arduino Training
1-ឧទាហ ណ៍ 1-Basic/DigitalReadSerial
/*
DigitalReadSerial
Reads a digital input on pin 2, prints the result to the serial monitor
This example code is in the public domain.
*/
2
National Technical Training Institute Arduino Training
void setup()
{
lcd.begin(16, 2); // start the library
lcd.setCursor(0,0);
lcd.print("SOU SOKCHEA TEST"); // print a simple message
}
void loop()
{
lcd.setCursor(9,1); // move cursor to second line "1" and 9 spaces over
lcd.print(millis()/1000); // display seconds elapsed since power-up
3
National Technical Training Institute Arduino Training
{
lcd.print("SELECT ");
break;
}
case btnNONE:
{
lcd.print("NONE ");
break;
}
}
3-ទាញមចញពីក៊ូែ ប
៊ូ ៉ា ៊ូត MCR
//Sample using LiquidCrystal library
#include <LiquidCrystal.h>
// For V1.0 comment the other threshold and use the one below:
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 195) return btnUP;
if (adc_key_in < 380) return btnDOWN;
if (adc_key_in < 555) return btnLEFT;
if (adc_key_in < 790) return btnSELECT;
4
National Technical Training Institute Arduino Training
void setup()
{
lcd.begin(16, 2); // start the library
lcd.setCursor(0,0);
lcd.print("SOKCHEA-TESTING*"); // print a simple message
}
void loop()
{
5
National Technical Training Institute Arduino Training
}
}
switch (count_menu) // depending on which button was pushed, we perform an action
{
case 0:
{ lcd.print("1. SENSORS ");
break;
}
case 1:
{ lcd.print("2. MOTORS ");
break;
}
case 2:
{ lcd.print("3. RC SERVO ");
break;
}
}
}