CD4066E Quad Switch | Speakertje | Arduino Nano | CNY17-3 - Optocoupler |
23LC1024-I/P - SRAM | Rotary Encoder | LCD 16x2 | ATtiny |
330R | 1k | 4k7 | 10k |
LED GEEL | LED ROOD | LED GROEN | Pushbutton |
7 Segment 4 Digit | Breadboard | 10k trimmer | Afstandsensor Ultrasoon |
USB kabel | Breadboard kabels | Servo | BT module |
100 nf | 1 uf | 10 uf | 2N7000 |
#include <Arduino.h>
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
#include <avr/io.>
#include <util/delay.h>
int main(void)
{
DDRB = 1 << 5;
while (1)
{
_delay_ms(500);
PORTB ^= 1 << 5;
}
return 0;
}
#include <Arduino.h>
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
Compiled size: 1034 bytes (3.2%)
#include <avr/io.>
#include <util/delay.h>
int main(void)
{
DDRB = 1 << 5;
while (1)
{
_delay_ms(500);
PORTB ^= 1 << 5;
}
return 0;
}
Compiled size: 158 bytes (0.5%)
enum states {IDLE = 'i', SET = 's', GET = 'g', TOGGLE = 't', COMPARE = 'c'};
uint8_t set_value, last_adc_val;
volatile uint8_t state = IDLE;
uint8_t last_state = GET;
void setup() {
Serial.begin(9600);
ADMUX |= (1 << REFS0) | (1 << MUX2) | (1 << MUX0);
ADCSRA |= (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0) | (1 << ADATE) | (1 << ADEN) | (1 << ADSC);
DDRD |= (1 << DDD3);
DDRB |= (1 << DDB1) | (1 << DDB2) | (1 << DDB3);
EICRA |= ((1 << ISC10) | (1 << ISC11)) ;
EIMSK |= (1 << INT1);
TCCR0A = 0;
TCCR0B = 0;
TCCR1A = 0;
TCCR1B = 0;
TCCR1A |= (1 << WGM10) | (1 << WGM00) | (1 << COM1A1) | (1 << COM1B1);
TCCR1B |= (1 << CS11) | (1 << CS10);
TCCR2A |= (1 << WGM20) | (1 << COM0A1);
TCCR2B |= (1 << CS22);
}
ISR(INT1_vect) {
state = COMPARE;
}
void set_values() {
Serial.print("Geef de waarde in: ");
set_value = Serial.parseInt();
Serial.println(set_value);
}
void toggle() {
EIMSK ^= (1 << INT1);
}
void compare() {
int diff = set_value - ADC / 4;
if (diff < 0) {
OCR2A = 0;
OCR1AL = abs(diff);
}
if (diff > 0) {
OCR1AL = 0;
OCR2A = abs(diff);
}
}
void loop() {
if (Serial.available()) state = Serial.read();
if (state != last_state) {
switch (state) {
case (IDLE):
Serial.println("Entered Idle State");
break;
case (SET):
set_values();
break;
case (GET):
Serial.println("Current ADC value: ");
Serial.println(ADC / 4);
break;
case (TOGGLE):
toggle();
break;
case (COMPARE):
compare();
break;
}
last_state = state;
}
if (last_state != TOGGLE) OCR1BL = ADC / 4;
}
Week | Theorie | Labo | |||
---|---|---|---|---|---|
Wie | Wat | Wie | Wat | Deadline studenten | |
M1W1 | MALU | Introductie | GVH | Kennismaking Kit, Beginner Tutorials, DUT | M1W3 |
M1W2 | MALU | Algemene IO operaties + Interrupts | GVH | Basis combinatie opdracht (gebruik verschillende componten) | M1W4 |
M1W3 | MALU | Serïele communicatie | GVH | Werken met een ATtiny | M1W5 |
M1W4 | MALU | C/C++ Fundementals + Libraries maken | GVH | Seriële communicatie met een ATtiny | M1W6 |
M1W5 | MALU | Bit Operaties + Intro IO operaties (ADC) | GVH | Mini Project: Maken van menu LCD met Rotary Encoder (individueel) | M1EX1 |
M1W6 | MALU | IO Operaties | GVH | Basis IO Operaties met registers #1 | M1EX1 |
M1EX1 | Vaardigheidstoets + Tonen werking Mini Project | M1EX1 |
Week | Theorie | Labo | |||
---|---|---|---|---|---|
Wie | Wat | Wie | Wat | Deadline studenten | |
M2W1 | GVH | Interrupts | MALU | Basis IO Operaties met registers #2 | M2W3 |
M2W2 | GVH | Interrupts | MALU | Interrupts #1 | M2W4 |
M2W3 | GVH | TImers | MALU | Interrupts #2 | M2W5 |
M2W4 | GVH | TImers | MALU | TImers #1 | M2W6 |
M2W5 | GVH | Seriële communicatie | MALU | TImers #2 | M2W7 |
M2W6 | GVH | Power Managment | MALU | Seriële communicatie | M2W7 |
M2W7 | GVH | Reserveles | MALU | Mini Test | |
M2EX1 | |||||
M2EX2 | |||||
M2EX3 |
Kennistoets | 30% | Digitaal examen |
Vaardigheidsexamen | 50% | Mondeling praktisch examen |
Vaardigheidstoets | 20% | 2 Testmomenten doorheen het jaar. |
void setup();
void loop();
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
void setup() | void loop() |
Loopt 1 maal | Eindeloze loop |
Initiële setup | Logica |
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
pinMode(POTPIN, INPUT);
pinMode(BTNPIN, INPUT_PULLUP);
void loop() {
//doSomething
}
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
void setup() {
pinMode(pushButton, INPUT);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
// read the input pin:
int buttonState = digitalRead(pushButton);
digitalWrite(LED_BUILTIN, buttonState);
}
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) {
analogWrite(ledPin, fadeValue);
delay(30);
}
for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) {
analogWrite(ledPin, fadeValue);
delay(30);
}
}
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
delay(1);
}