Using CodeWarrior write a program to display the following p

Using CodeWarrior, write a program to display the following patterns from the seven-segment display from display #3 down to #0 and repeat with each pattern lasting for 600 ms. 1234->2345->3456->4567->5678->6789->7891->8912->9123->1234

Solution

#include <Wire.h>
#include <MCP23018.h>
#include <MSQC6XX2C.h>

MCP23018 pex(0);
MSQC6XX2C display(&pex);

void setup()
{
Wire.begin();
pex.begin();
display.begin();
}

uint8_t values[] = { 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4 };
uint8_t* values_end = values + 10;
uint8_t* values_current = values;

void loop()
{
// Send the current 4 values to the display
display.set(values_current);

// Increment to the next set of values, or wrap around to
// the start
if ( ++values_current >= values_end )
values_current = values;

// Wait
delay(600);
}

Using CodeWarrior, write a program to display the following patterns from the seven-segment display from display #3 down to #0 and repeat with each pattern last

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site