Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/Gw5BpioW)
# Signals - Week 1

For all of our activities and code running, we'll be using the [ARM mbed Simulator](http://195.130.59.221/)
Expand Down
13 changes: 6 additions & 7 deletions week1_exercise1.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
//STARTER
//THIS EXERCISE IS TO BE DONE IN THE ARM MBED SIMULATOR
//http://195.130.59.221/
//IF YOU HAVE ISSUES WITH THE SIMULATOR, CONTACT EMBEDDED LEAD
#include "mbed.h"

DigitalOut led(LED1);
DigitalIn button(BUTTON1);

int main() {
while (1) {
printf("Week 1 Exercise 1");
led = button;
printf("Blink! LED is now %d\n", button.read());

// MAKE SURE THERE IS ALWAYS A WAIT ON THE SIM OR IT WILL CRASH
wait_ms(500);
wait_ms(50);
}
}
16 changes: 9 additions & 7 deletions week1_exercise2.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
//STARTER
//THIS EXERCISE IS TO BE DONE IN THE ARM MBED SIMULATOR
//http://195.130.59.221/
//IF YOU HAVE ISSUES WITH THE SIMULATOR, CONTACT EMBEDDED LEAD
#include "mbed.h"

DigitalOut led(LED1);
AnalogIn pot(p15);

int main() {
while (1) {
printf("Week 1 Exercise 2");
led = !led;

wait_ms(pot.read() * 2000);

led = !led;

// MAKE SURE THERE IS ALWAYS A WAIT ON THE SIM OR IT WILL CRASH
wait_ms(500);
wait_ms(2000 - (pot.read() * 2000));
}
}