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
8 changes: 4 additions & 4 deletions Firmware/project_1/inc/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@
#define P_LED3 P0_6
#define P_LED4 P0_7
// PROJECT 1 - You can define a pin macro here

#define P_LED P0_4
/*
* COMMON PIN OBJECT DECLARATIONS
*/

extern DigitalOut led1;
extern DigitalOut led2;
extern DigitalOut led3;
extern DigitalOut led4;
// PROJECT 1 - You can declare a DigitalOut object here

extern DigitalOut led;
/*
* BOARD SPECIFIC PINS
*/

// PROJECT 2 - You can declare a AnalogIn object here

extern AnalogIn pot;

/*
* BOARD SPECIFIC PIN OBJECT DECLARATIONS
Expand Down
8 changes: 7 additions & 1 deletion Firmware/project_1/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include <mbed.h>
// PROJECT 1 - Include something here!
#include "pins.h"
#include "DigitalOut.h"
#include "peripherals.h"
#include "can_struct.h"
#include "CAN/can_id.h"
Expand Down Expand Up @@ -97,10 +99,14 @@ int main() {

if(timing.tickThreshold(last_task_1_time, TASK_1_RATE_US)){
//PROJECT 1 - add code here to actually make the LED blink
led = !led;
}

//PROJECT 2 - use the potentiometer to change the blink rate

float pot_input = pot.read();
const float scaling = 900000.0f;
const float min = 100000.0f;
int TASK1_RATE_US = min + pot_input * scaling;

}

Expand Down
3 changes: 2 additions & 1 deletion Firmware/project_1/src/pins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/

// PROJECT 2 - You can instantiate your AnalogIn object here

AnalogIn pot(A0);
/*
* COMMON PIN OBJECT INSTANTIATIONS
*/
Expand All @@ -23,3 +23,4 @@ DigitalOut led2(P_LED2);
DigitalOut led3(P_LED3);
DigitalOut led4(P_LED4);
// PROJECT 1 - You can instantiate your DigitalOut object here
Digitalout led(P_LED);
266 changes: 266 additions & 0 deletions Hardware/prog1/Title_Block.kicad_wks

Large diffs are not rendered by default.

135 changes: 135 additions & 0 deletions Hardware/prog1/fp-lib-table

Large diffs are not rendered by default.

Loading