File tree Expand file tree Collapse file tree 6 files changed +77
-0
lines changed
12-sensor_temperature_lm35 Expand file tree Collapse file tree 6 files changed +77
-0
lines changed Original file line number Diff line number Diff line change 1+ const int buzzPin = 3 ;
2+
3+ void setup () {
4+ pinMode (buzzPin, OUTPUT);
5+ }
6+
7+ void loop () {
8+ digitalWrite (buzzPin, HIGH);
9+ delay (500 );
10+ digitalWrite (buzzPin, LOW);
11+ delay (3000 );
12+ }
Original file line number Diff line number Diff line change 1+ const int redPin = 11 ;
2+ const int bluePin = 10 ;
3+ const int greenPin = 9 ;
4+
5+ void setup () {
6+ pinMode (redPin, OUTPUT);
7+ pinMode (bluePin, OUTPUT);
8+ pinMode (greenPin, OUTPUT);
9+ }
10+
11+ void loop () {
12+ for (int i = 0 ; i < 255 ; i++) {
13+ analogWrite (redPin, i);
14+ analogWrite (bluePin, 128 - i);
15+ analogWrite (greenPin, 255 - i);
16+ delay (2 );
17+ }
18+
19+ for (int i = 255 ; i > 0 ; i--) {
20+ analogWrite (redPin, i);
21+ analogWrite (bluePin, 128 - i);
22+ analogWrite (greenPin, 255 - i);
23+ delay (2 );
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ ![ ] ( led_rgb.webp )
Original file line number Diff line number Diff line change 1+ const int temprPin = A0; // temperature sensor pin
2+
3+ void setup () {
4+ Serial.begin (9600 );
5+ // pinMode(A0, INPUT);
6+ pinMode (temprPin, INPUT);
7+ }
8+
9+ void loop () {
10+ const int sensor = analogRead (temprPin);
11+
12+ Serial.print (sensor * 5.0 / 1023.0 ); // voltage
13+ Serial.print (" V (" );
14+ Serial.print (sensor);
15+ Serial.print (" )" );
16+
17+ const int tempr = (sensor * 125 ) >> 8 ;
18+ Serial.print (" = " );
19+ Serial.print (tempr);
20+ Serial.print (" C" );
21+
22+ Serial.print (" \n " );
23+ delay (500 );
24+ }
Original file line number Diff line number Diff line change 1+ ```
2+ ...
3+ 0.28V (57) = 27C
4+ 0.28V (58) = 28C
5+ 0.28V (57) = 27C
6+ 0.28V (57) = 27C
7+ 0.28V (57) = 27C
8+ 0.28V (58) = 28C
9+ 0.29V (59) = 28C
10+ 0.30V (61) = 29C
11+ 0.30V (61) = 29C
12+ 0.30V (61) = 29C
13+ 0.30V (62) = 30C
14+ ...
15+ ```
You can’t perform that action at this time.
0 commit comments