Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
- Committer:
- billymark
- Date:
- 2018-02-28
- Revision:
- 0:0f1c2bf6ab4e
File content as of revision 0:0f1c2bf6ab4e:
/**********************************************************
* EECS 397
*
* Assignment Name: Lab 1: Two_speed_blinky
*
* Author(s): Markowitz, Billy;
*
* Purpose: turn the User LED on for .5 seconds, off for 1 second, on for .5 seconds,
* off for 2 seconds, and then repeat sequence ad infinitum.
*
* Last Modified 2018-01-24
*
**********************************************************/
#include <mbed.h>
#include <io_pins.h>
#include <display.h>
int main(void)
{
// Configuring the Controller
dsp_ncs = 1;
display_ctr.format(16); // 16 bits per frame, mode 0
dsp_ncs = 0;
send_data(0x0f01);
wait(1.5);
send_data(0x0F00);
send_data(0x0A0F);
send_data(0x0B04);
send_data(0x0C01); //set to normal shutdown mode
send_data(0x090F); //configures the decode register
send_data(DISPLAY_1); //Digit 1 is 0
send_data(DISPLAY_2);
send_data(DISPLAY_3);
send_data(DISPLAY_4);
int data;
int current_register = DISPLAY_1;
// main loop
pc.printf("Please Enter a Digit from 0-9 \n");
while(1) {
if(pc.readable()) {
data = pc.getc()-48;
if(data >= 0 && data <= 9) {
send_data(current_register+data);
if(current_register < 0x0500) {
current_register = current_register + 0x0100;
}
else
current_register = DISPLAY_1;
pc.printf("Please Enter a Digit from 0-9 \n");
}
else
pc.printf("Please print a valid number \n");
}
}
}