This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long long int last_states = 0; | |
void setup() { | |
pinMode(2, OUTPUT); | |
pinMode(A0, INPUT); | |
} | |
void loop() { | |
last_states = last_states << 1; | |
if(analogRead(A0) > 600){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
pinMode(2, OUTPUT); | |
pinMode(A0, INPUT); | |
} | |
void loop() { | |
if(analogRead(A0) > 600){ | |
digitalWrite(2, !digitalRead(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//here we have definision of pins for 7 segment display if you want to use different pins you can just change it here | |
#define LED_A 2 | |
#define LED_B 3 | |
#define LED_C 4 | |
#define LED_D 5 | |
#define LED_E 6 | |
#define LED_F 7 | |
#define LED_G 8 | |
#define LED_DP 9 | |
#define LED_CHAR1 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
pinMode(13, OUTPUT); | |
} | |
void loop() { | |
digitalWrite(13, HIGH); | |
delay(1000); | |
digitalWrite(13, LOW); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//we need this value to know which coil should be turned on in stepper motor | |
int step_count; | |
void setup() { | |
//seting up pins as outputs for motor driver | |
pinMode(2, OUTPUT); | |
pinMode(3, OUTPUT); | |
pinMode(4, OUTPUT); | |
pinMode(5, OUTPUT); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float now_r = 0, now_g = 0, now_b = 0; | |
float ran_r, ran_g, ran_b; | |
void setup() { | |
pinMode(9, OUTPUT); | |
pinMode(10, OUTPUT); | |
pinMode(11, OUTPUT); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
pinMode(9, OUTPUT); | |
pinMode(10, OUTPUT); | |
pinMode(11, OUTPUT); | |
} | |
void loop() { | |
for(int r = 0; r < 255; r++){ | |
analogWrite(9, r); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
//on pin12 we have the rain sensor so this is an input | |
pinMode(12, INPUT); | |
//on pin 13 we have buzzer so this is an output | |
pinMode(13, OUTPUT); | |
} | |
void loop() { | |
//when rain sensor gives LOW signal it means that it rains |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
//declaring pin 13 as output to control transistor | |
pinMode(13, OUTPUT); | |
} | |
void loop() { | |
//slowly increasing the PWM signal on the transistor base | |
for(int a = 0; a < 255; a++){ | |
analogWrite(13, a); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//here we can declare time of each blink | |
int led_1_blink_time = 200; | |
int led_2_blink_time = 500; | |
int led_3_blink_time = 1100; | |
int led_4_blink_time = 100; | |
int led_5_blink_time = 1630; | |
int led_6_blink_time = 333; | |
//we need this variable to store last time of blink in milliseconds | |
long led_1_last_blink; |
NewerOlder