목록Arduino(C,C++) (20)
Creative Code
#define V0 5.0 #define unit V0/1024 #define R1 10000.0 const int Xin = A0; const int Yin = A1; const int KEYin = 3; void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(KEYin,INPUT_PULLUP); // 칩 내부에 있는 pull up 저항을 사용 } void loop() { // put your main code here, to run repeatedly: int Xval = analogRead(Xin); int Yval = analogRead(Yin); int buttonval = digitalRead(..
#define V0 5.0 #define unit V0/1024 #define R1 10000.0 const int Xin = A0; const int Yin = A1; const int KEYin = 3; void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(KEYin,INPUT_PULLUP); // 칩 내부에 있는 pull up 저항을 사용 } void loop() { // put your main code here, to run repeatedly: int Xval = analogRead(Xin); int Yval = analogRead(Yin); int buttonval = digitalRead(..
#define V0 5.0 #define unit V0/1024 #define R1 10000.0 const int led_0 = 3; const int analogPin = A0; void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(led_0,OUTPUT); } void loop() { // put your main code here, to run repeatedly: int analogValue = analogRead(analogPin); float V2 = analogValue * unit; Serial.println(analogValue); analogWrite(led_0,map(analogVa..
#define V0 5.0 #define unit V0/1024 #define R1 10000.0 const int analogPin = A0; void setup() { // put your setup code here, to run once: Serial.begin(115200); } void loop() { // put your main code here, to run repeatedly: int analogValue = analogRead(analogPin); // analogpin에 연결했을때 float V2 = analogValue * unit; float R2 = V2 * R1 / (V0 - V2); Serial.print(analogValue); Serial.print(", "); Seri..
#include "PinChangeInterrupt.h" const int led[6] = {8,9,10,11,12,13}; const int SW_0 = 4; int cnt =0; void SW0_Pressed(void) { for (int i = 0; i
const int SW_0 = 2; const int led_0 = 13; const int SW_1 = 3; const int led_1 = 12; int led_flag_0 = 0; // 0 : OFF , 1 : ON int led_flag_1 = 0; //사용자 함수 void SW0_Pressed(void) { if (led_flag_0 == 0) { } else { digitalWrite(led_0,LOW); led_flag_0 = 0; } } void SW1_Pressed(void) { if (led_flag_1 == 0) { digitalWrite(led_1,HIGH); led_flag_1 =1; } else { digitalWrite(led_1,LOW); led_flag_1 = 0; } } ..