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
Expand Up @@ -30,3 +30,4 @@ This repository contains both lab materials and code examples for all the Electr




2 changes: 1 addition & 1 deletion Tasks/HelloWorld/mbed-os.lib
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://github.com/ARMmbed/mbed-os/#d147abc3e556c58e5e343d34b729bc2192e18bd3
https://github.com/ARMmbed/mbed-os/#17dc3dc2e6e2817a8bd3df62f38583319f0e4fed
4 changes: 2 additions & 2 deletions Tasks/Task-101-Blinky/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ int main()
greenLED = 1;

// Wait 0.2 second (1 million microseconds)
wait_us(100000);
wait_us(1000000);

// Turn LED OFF
greenLED = 0;

// Wait 0.2 second
wait_us(100000);
wait_us(1000000);
}
}
2 changes: 1 addition & 1 deletion Tasks/Task-102-SOS-Soln/libuopmsb.lib
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://github.com/UniversityOfPlymouth-Electronics/libuopmsb#bc28793ff33e2e645630e4a52a061f7966004c81
https://github.com/UniversityOfPlymouth-Electronics/libuopmsb#27da580f0d75e28bbf0b1ea82cab487a963da679
9 changes: 5 additions & 4 deletions Tasks/Task-102-SOS-Soln/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Chris Tipney September 2020 V1.0

// You need this to use the Module Support Board
#include "mbed.h"
#include "uop_msb.h"
using namespace uop_msb;

Expand Down Expand Up @@ -53,12 +54,12 @@ void dot()
// ON
greenLED = 1; // LED ON
buzz.playTone("C"); // Play tone
wait_us(150000); // Wait 150ms
wait_us(550000); // Wait 250ms

// OFF
greenLED = 0; // LED OFF
buzz.rest(); // Stop tone
wait_us(150000); // Wait 150ms
wait_us(250000); // Wait 250ms
}

// Send one dash symbol
Expand All @@ -69,12 +70,12 @@ void dash()
// ON
greenLED = 1; // LED ON
buzz.playTone("C"); // Play tone
wait_us(450000); // Wait 450ms
wait_us(550000); // Wait 550ms

// OFF
greenLED = 0; // LED OFF
buzz.rest(); // Stop tone
wait_us(150000); // Wait 150ms
wait_us(1000000); // Wait 550ms
}

// Send letterspace 450 ms minus the 150 ms from the last symbol = 300 ms
Expand Down
122 changes: 119 additions & 3 deletions Tasks/Task-102-SOS/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,133 @@ int main()
//On for 500ms
greenLED = 1;
buzz.playTone("C");
wait_us(WAIT_TIME_MS * 1000); //500ms
wait_us(WAIT_TIME_MS * 150); //500ms


//Off for 500ms
greenLED = 0;
buzz.playTone("C", Buzzer::HIGHER_OCTAVE);
wait_us(WAIT_TIME_MS * 1000); //500ms
wait_us(WAIT_TIME_MS * 150); //500ms

//Pause
buzz.rest();
wait_us(WAIT_TIME_MS * 1000);
wait_us(WAIT_TIME_MS * 500); // 1 DOT

//On for 500ms
greenLED = 1;
buzz.playTone("C");
wait_us(WAIT_TIME_MS * 150); //500ms


//Off for 500ms
greenLED = 0;
buzz.playTone("C", Buzzer::HIGHER_OCTAVE);
wait_us(WAIT_TIME_MS * 150); //500ms

//Pause
buzz.rest();
wait_us(WAIT_TIME_MS * 500); // 2 Dot

//On for 500ms
greenLED = 1;
buzz.playTone("C");
wait_us(WAIT_TIME_MS * 150); //500ms


//Off for 500ms
greenLED = 0;
buzz.playTone("C", Buzzer::HIGHER_OCTAVE);
wait_us(WAIT_TIME_MS * 150); //500ms

//Pause
buzz.rest();
wait_us(WAIT_TIME_MS * 500); //3 dot

//On for 500ms
greenLED = 1;
buzz.playTone("C");
wait_us(WAIT_TIME_MS * 450); //500ms


//Off for 500ms
greenLED = 0;
buzz.playTone("C", Buzzer::HIGHER_OCTAVE);
wait_us(WAIT_TIME_MS * 450); //500ms

//Pause
buzz.rest();
wait_us(WAIT_TIME_MS * 500); //1 dash


//On for 500ms
greenLED = 1;
buzz.playTone("C");
wait_us(WAIT_TIME_MS * 450); //500ms


//Off for 500ms
greenLED = 0;
buzz.playTone("C", Buzzer::HIGHER_OCTAVE);
wait_us(WAIT_TIME_MS * 450); //500ms
//Pause
buzz.rest();
wait_us(WAIT_TIME_MS * 500); //2 dash
//On for 500ms
greenLED = 1;
buzz.playTone("C");
wait_us(WAIT_TIME_MS * 450); //500ms


//Off for 500ms
greenLED = 0;
buzz.playTone("C", Buzzer::HIGHER_OCTAVE);
wait_us(WAIT_TIME_MS * 450); //500ms
//Pause
buzz.rest();
wait_us(WAIT_TIME_MS * 500); // 3 dash
//On for 500ms
greenLED = 1;
buzz.playTone("C");
wait_us(WAIT_TIME_MS * 150); //500ms


//Off for 500ms
greenLED = 0;
buzz.playTone("C", Buzzer::HIGHER_OCTAVE);
wait_us(WAIT_TIME_MS * 150); //500ms

//Pause
buzz.rest();
wait_us(WAIT_TIME_MS * 500); // 1 DOT

//On for 500ms
greenLED = 1;
buzz.playTone("C");
wait_us(WAIT_TIME_MS * 150); //500ms


//Off for 500ms
greenLED = 0;
buzz.playTone("C", Buzzer::HIGHER_OCTAVE);
wait_us(WAIT_TIME_MS * 150); //500ms

//Pause
buzz.rest();
wait_us(WAIT_TIME_MS * 500); // 2 Dot

//On for 500ms
greenLED = 1;
buzz.playTone("C");
wait_us(WAIT_TIME_MS * 150); //500ms


//Off for 500ms
greenLED = 0;
buzz.playTone("C", Buzzer::HIGHER_OCTAVE);
wait_us(WAIT_TIME_MS * 150); //500ms

//Pause
buzz.rest();
wait_us(WAIT_TIME_MS * 500); //3 dot
}
}
2 changes: 1 addition & 1 deletion Tasks/Task-102-SOS/mbed-os.lib
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://github.com/ARMmbed/mbed-os/#d147abc3e556c58e5e343d34b729bc2192e18bd3
https://github.com/ARMmbed/mbed-os/#17dc3dc2e6e2817a8bd3df62f38583319f0e4fed
26 changes: 20 additions & 6 deletions Tasks/Task-103-HelloWorld/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//#include mbed.h
#include "uop_msb.h"
using namespace uop_msb;

Expand Down Expand Up @@ -33,20 +34,33 @@ int main()

// This is a variable (not an oject as it has no functions) that stores a whole number (integer) in memory
// (I used the keyword volatile to force it to use memory... long story and one for later)
volatile int counter = 0;

//volatile int counter = 0; // count from 0 to 4 and 0 to 10
volatile int counter = 10; // count from 10 to 15

while (true)
while (counter <= 15)
//while (counter < 10)
// while (counter < 4 )
{
//Toggle the LED
ledBlue = !ledBlue;

//Add 1 to the counter "variable"
counter = counter + 1;

//Display in the terminal
printf("Count: %d\n", counter);

//Wait
wait_us(WAIT_TIME_MS * 1000);

//Add 1 to the counter "variable"
counter = counter + 1;
}
}

ledRed = 1;
ledGreen = 1;
ledBlue = 1;

wait_us(osWaitForever);


}

2 changes: 1 addition & 1 deletion Tasks/Task-103-HelloWorld/mbed-os.lib
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://github.com/ARMmbed/mbed-os/#d147abc3e556c58e5e343d34b729bc2192e18bd3
https://github.com/ARMmbed/mbed-os/#17dc3dc2e6e2817a8bd3df62f38583319f0e4fed
52 changes: 33 additions & 19 deletions Tasks/Task-104-TrafficLights/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,41 @@ LCD_16X2_DISPLAY lcd;

int main()
{
lcd.puts("RED");
wait_us(1000000);
while (true)
{
lcd.puts("RED");
wait_us(1000000);

amber = 1;
lcd.cls();
lcd.puts("Amber");
wait_us(1000000);
amber = 1;
lcd.cls();
lcd.puts("Amber");
wait_us(1000000);

green = 1;
lcd.cls();
lcd.puts("Green");
wait_us(1000000);
red = 0;
amber = 0;

lcd.cls();
lcd.puts("TASK-104");
green = 1;
lcd.cls();
lcd.puts("Green");
wait_us (1000000);

while (true)
{
red = !red;
amber = !amber;
green = !green;
wait_us(WAIT_TIME_MS * 1000);
green = 0;
amber = 0;

lcd.cls();
lcd.puts("amber");
wait_us (1000000);

amber = 0;

red = 1;
lcd.cls();
lcd.puts("");
wait_us (1000000);
}




}
}
2 changes: 1 addition & 1 deletion Tasks/Task-104-TrafficLights/mbed-os.lib
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://github.com/ARMmbed/mbed-os/#d147abc3e556c58e5e343d34b729bc2192e18bd3
https://github.com/ARMmbed/mbed-os/#17dc3dc2e6e2817a8bd3df62f38583319f0e4fed
Loading