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
Fork of Lab_6_WaG by
main.cpp
- Committer:
- phn10
- Date:
- 2018-02-22
- Revision:
- 8:d8bc78bda829
- Parent:
- 7:161fe3793ddb
- Child:
- 11:6751b9406142
File content as of revision 8:d8bc78bda829:
/******************************************************************************
* EECS 397
*
* Assignment Name: Lab 4: display_test2
*
* Authors: Sam Morrison and Phong Nguyen
*
* Purpose: Configures the board for 5-digit display
*
* Last Modified: 02/19/2018
*
******************************************************************************/
#include "mbed.h"
#include "io_pins.h"
#include "display.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int data_length = 16;
int frequency = 1000000;
DigitalOut SS(CHIP_SELECT);
SPI spi(MOSI, MISO, SCLK);
Serial pc(USBTX, USBRX);
int main(void) {
initial_setup(SS, data_length, frequency);
float command = 0x0100;
int input;
//char command_text[10] = "0x0";
while(1) {
pc.printf("Select a digit between 0 and 9999:\n");
bool check = scanf("%d", &input);
while (check != 1) {
pc.printf("Select a digit between 0 and 9999:\n");
check = scanf("%d", &input);
}
/*
while (num_range(input) == false) { //ask for input until 0-9999 is selected
pc.printf("Select a digit between 0 and 9999:\n");
scanf("%d", input);
}
command_text[3] = place + '0';
command_text[4] = '0';
command_text[5] = input;
command = atof(command_text); //converts string to float
*/
//pc.printf("command: %s\n", command_text);
SS = 0;
spi.write(command); // need to cycle 4 times
SS = 1;
//pc.printf("command: &f\n", commmand);
}
/*
SS = 0;
spi.write(0x0100); //set digit 0 to 0
SS = 1;
*/
}
