Skip to content

Commit 17e63a0

Browse files
committed
Updated code
1 parent 8ce4b15 commit 17e63a0

13 files changed

+174
-0
lines changed
11.7 KB
Binary file not shown.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Bas on Tech - HCS501 PIR motion sensor
3+
*
4+
* This course is part of the courses on https://arduino-tutorials.net
5+
*
6+
* (c) Copyright 2019 - Bas van Dijk / Bas on Tech
7+
* This code and course is copyrighted. It is not allowed to use these courses commercially
8+
* without explicit written approval
9+
*
10+
* YouTube: https://www.youtube.com/c/BasOnTech
11+
* Facebook: https://www.facebook.com/BasOnTechChannel
12+
* Instagram: https://www.instagram.com/BasOnTech
13+
* Twitter: https://twitter.com/BasOnTech
14+
*
15+
*/
16+
17+
int ledPin = 13; // Buildin LED on pin 13 of the Arduino
18+
int pirPin = 12; // Pin for the HC-S501 sensor
19+
int pirValue; // Value of the PIR
20+
21+
void setup() {
22+
pinMode(ledPin, OUTPUT); // Set the ledPin as output
23+
pinMode(pirPin, INPUT); // Set the pirPin as input
24+
digitalWrite(ledPin, LOW); // Turn off of the buildin LED
25+
}
26+
27+
void loop() {
28+
pirValue = digitalRead(pirPin); // Read the PIR value
29+
digitalWrite(ledPin, pirValue); // Write the PIR value to the buildin LED
30+
}
88.3 KB
Loading
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# HC-501 Motion sensor (PIR)
2+
Part of the Bas on Tech Arduino YouTube tutorials - More info at https://arduino-tutorials.net
3+
4+
Subscribe to the Bas on Tech YouTube channel via http://www.youtube.com/c/BasOnTech?sub_confirmation=1
5+
6+
## The circuit
7+
![alt text](./HC-S501-pir-motion-sensor.png "the circuit")

E23-slide-potentiometer/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Slide potentiometer
2+
Part of the Bas on Tech Arduino YouTube tutorials - More info at https://arduino-tutorials.net
3+
4+
Subscribe to the Bas on Tech YouTube channel via http://www.youtube.com/c/BasOnTech?sub_confirmation=1
5+
6+
## The circuit
7+
![alt text](./slide-potentiometer.png "the circuit")
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Bas on Tech - Schuif potmeter
3+
* Deze les is onderdeel van de lessen op https://arduino-lessen.nl
4+
*
5+
* (c) Copyright 2019 - Bas van Dijk / Bas on Tech
6+
* Deze code en inhoud van de lessen mag zonder schriftelijke toestemming
7+
* niet voor commerciele doeleinden worden gebruikt
8+
*
9+
* YouTube: https://www.youtube.com/c/BasOnTechNL
10+
* Facebook: https://www.facebook.com/BasOnTechChannel
11+
* Instagram: https://www.instagram.com/BasOnTech
12+
* Twitter: https://twitter.com/BasOnTech
13+
*
14+
*/
15+
16+
int potmeterPin = A0; // Schuif potmeter pin op A0
17+
int potmeterVal = 0; // Waarde van potmeter
18+
19+
void setup() {
20+
Serial.begin(9600); // Stel de seriële monitor in
21+
}
22+
23+
// Herhaal oneindig
24+
void loop() {
25+
26+
potmeterVal = analogRead(potmeterPin); // Lees de analoge waarde van de Schuif potmeter
27+
28+
// Het totale bereik is 1024 stappen: 0 t/m 1023
29+
// In de opdracht vraag ik je van 512 t/m -512 te maken
30+
// Dit zijn 1025 stappen: 2 x 512 = 1024, en dan nog 1 stap voor de 0
31+
// Daarom moeten we controleren of het getal groter is dan 0
32+
// Als dit zo is dan tellen we er 1 bij op om zo op 512 uit te komen
33+
// in plaats van 511
34+
if (potmeterVal > 0) {
35+
potmeterVal++;
36+
}
37+
38+
Serial.println(potmeterVal - 512); // Toon de waarde in de seriële monitor
39+
40+
delay(100); // Pauzeer 100ms
41+
42+
}
3.22 KB
Binary file not shown.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Bas on Tech - Slide potentiometer
3+
*
4+
* This course is part of the courses on https://arduino-tutorials.net
5+
*
6+
* (c) Copyright 2019 - Bas van Dijk / Bas on Tech
7+
* This code and course is copyrighted. It is not allowed to use these courses commercially
8+
* without explicit written approval
9+
*
10+
* YouTube: https://www.youtube.com/c/BasOnTech
11+
* Facebook: https://www.facebook.com/BasOnTechChannel
12+
* Instagram: https://www.instagram.com/BasOnTech
13+
* Twitter: https://twitter.com/BasOnTech
14+
*
15+
*/
16+
17+
int potmeterPin = A0; // Slide potentiometer on pin A0
18+
int potmeterVal = 0; // Slide potentiometer value
19+
20+
void setup() {
21+
Serial.begin(9600); // Initialise the serial monitor
22+
}
23+
24+
void loop() {
25+
26+
potmeterVal = analogRead(potmeterPin); // Read the analog value of the slide potentiometer
27+
28+
Serial.println(potmeterVal); // Show the value on the serial monitor
29+
30+
delay(100); // Pause 100ms
31+
32+
}
84.7 KB
Loading

E24-SG90-tower-pro-servo/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SG90 Tower Pro Servo
2+
Part of the Bas on Tech Arduino YouTube tutorials - More info at https://arduino-tutorials.net
3+
4+
Subscribe to the Bas on Tech YouTube channel via http://www.youtube.com/c/BasOnTech?sub_confirmation=1
5+
6+
## The circuit
7+
![alt text](./SG90-tower-pro-servo.png "the circuit")

0 commit comments

Comments
 (0)