목록전체 글 (418)
Creative Code
#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; } } ..
const int led[6] = {8,9,10,11,12,13}; const int SW_0 = 2; const int SW_1 = 3; int cnt =0; void SW0_Pressed(void) { for (int i = 0; i
const int SW_0 = 2; //스위치를 연결하는 핀은 2번,3번만 가능하다. const int led_0 = 12; int led_flag = 0; // 0 : OFF , 1 : ON void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(SW_0,INPUT); // 스위치 버튼은 사용자가 입력하는 방식이기에 input을 쓴다. pinMode(led_0,OUTPUT); digitalWrite(led_0,LOW); } void loop() { // put your main code here, to run repeatedly: int digitalValue = digitalRead(SW_0); if ..