Ja, som det kan ses af nedenstående, så skriver jeg nogle gange på Engelsk.
Teksten til højre for // er en kort beskrivelse af hvad hver linje gør.
/* * Test of SparkFun's 4 Digit 7-Segment Serial Display - * Kelly Green - COM-11440 * or a look a like... * * Clearing the Display and setting the brightness level. * Test Digit placing. * Test of all segments in each digit at the same time * Test of Decimal Points, Colon and Apostrophe * * In the loop are we testing each segment individually * Digit 1 Individual Segment Control command byte 0x7B * Digit 2 Individual Segment Control command byte 0x7C * Digit 3 Individual Segment Control command byte 0x7D * Digit 4 Individual Segment Control command byte 0x7E * Segment 1 are the horisontal in the top * Segment 2,3,4,5,6 are clockwise round the edge on the display * Segment 7 are in the mid */ void setup() // Run once, when the sketch starts { Serial.begin(9600); // Setting communication up at 9600 bps on TX pin at Arduino Uno Serial.write(0x76); // Clear the display and set for Digit 1 delay(1000); // Delay for clearing the Display Serial.write(0x7A); // Command for brightness Serial.write(0x01); // Brightness level delay(10); // Delay for changing brightness Serial.write("1234"); // Display read out 1234 delay(2000); // Time for Display read out Serial.write("8888"); // Display read out 8888 delay(1500); // Time for Display read out Serial.write(0x76); // Clear the display and set for Digit 1 delay(10); // Delay for clearing the Display Serial.write(0x77); // Command for decimal point Serial.write(0x01); // Display read out decimal point digit 1 delay(500); // Time for Display read out Serial.write(0x77); // Command for decimal point Serial.write(0x02); // Display read out decimal point digit 2 delay(500); // Time for Display read out Serial.write(0x77); // Command for decimal point Serial.write(0x04); // Display read out decimal point digit 3 delay(500); // Time for Display read out Serial.write(0x77); // Command for decimal point Serial.write(0x08); // Display read out decimal point digit 4 delay(500); // Time for Display read out Serial.write(0x77); // Command for decimal point Serial.write(0x10); // Display read out Time Colon delay(500); // Time for Display read out Serial.write(0x77); // Command for decimal point Serial.write(0x20); // Display read out Apostrophe delay(500); // Time for Display read out Serial.write(0x77); // Command for decimal point Serial.write(0x40); // Switch off decimal point } void loop() // Run over and over again { Serial.write(0x76); // Clear the display and set for Digit 1 delay(10); // Delay for clearing the Display Serial.write(0x7B); // Digit 1 Individual Segment Control Serial.write(0b00000001); // Segment 1 are ON delay(500); // Time for Display read out Serial.write(0x7B); // Digit 1 Individual Segment Control Serial.write(0b00000010); // Segment 2 are ON delay(500); // Time for Display read out Serial.write(0x7B); // Digit 1 Individual Segment Control Serial.write(0b00000100); // Segment 3 are ON delay(500); // Time for Display read out Serial.write(0x7B); // Digit 1 Individual Segment Control Serial.write(0b00001000); // Segment 4 are ON delay(500); // Time for Display read out Serial.write(0x7B); // Digit 1 Individual Segment Control Serial.write(0b00010000); // Segment 5 are ON delay(500); // Time for Display read out Serial.write(0x7B); // Digit 1 Individual Segment Control Serial.write(0b00100000); // Segment 6 are ON delay(500); // Time for Display read out Serial.write(0x7B); // Digit 1 Individual Segment Control Serial.write(0b01000000); // Segment 7 are ON delay(500); // Time for Display read out Serial.write(0x7B); // Digit 1 Individual Segment Control Serial.write(0b01111111); // All segments are ON Serial.write(0x77); // Command for decimal point Serial.write(0x01); // Display read out decimal point digit 1 delay(500); // Time for Display read out Serial.write(0x7C); // Digit 2 Individual Segment Control Serial.write(0b00000001); // Segment 1 are ON delay(500); // Time for Display read out Serial.write(0x7C); // Digit 2 Individual Segment Control Serial.write(0b00000010); // Segment 2 are ON delay(500); // Time for Display read out Serial.write(0x7C); // Digit 2 Individual Segment Control Serial.write(0b00000100); // Segment 3 are ON delay(500); // Time for Display read out Serial.write(0x7C); // Digit 2 Individual Segment Control Serial.write(0b00001000); // Segment 4 are ON delay(500); // Time for Display read out Serial.write(0x7C); // Digit 2 Individual Segment Control Serial.write(0b00010000); // Segment 5 are ON delay(500); // Time for Display read out Serial.write(0x7C); // Digit 2 Individual Segment Control Serial.write(0b00100000); // Segment 6 are ON delay(500); // Time for Display read out Serial.write(0x7C); // Digit 2 Individual Segment Control Serial.write(0b01000000); // Segment 7 are ON delay(500); // Time for Display read out Serial.write(0x7C); // Digit 2 Individual Segment Control Serial.write(0b01111111); // All segments are ON Serial.write(0x77); // Command for decimal point Serial.write(0x02); // Display read out decimal point digit 2 delay(500); // Time for Display read out Serial.write(0x77); // Command for decimal point Serial.write(0x10); // Display read out Time Colon delay(500); // Time for Display read out Serial.write(0x7D); // Digit 3 Individual Segment Control Serial.write(0b00000001); // Segment 1 are ON delay(500); // Time for Display read out Serial.write(0x7D); // Digit 3 Individual Segment Control Serial.write(0b00000010); // Segment 2 are ON delay(500); // Time for Display read out Serial.write(0x7D); // Digit 3 Individual Segment Control Serial.write(0b00000100); // Segment 3 are ON delay(500); // Time for Display read out Serial.write(0x7D); // Digit 3 Individual Segment Control Serial.write(0b00001000); // Segment 4 are ON delay(500); // Time for Display read out Serial.write(0x7D); // Digit 3 Individual Segment Control Serial.write(0b00010000); // Segment 5 are ON delay(500); // Time for Display read out Serial.write(0x7D); // Digit 3 Individual Segment Control Serial.write(0b00100000); // Segment 6 are ON delay(500); // Time for Display read out Serial.write(0x7D); // Digit 3 Individual Segment Control Serial.write(0b01000000); // Segment 7 are ON delay(500); // Time for Display read out Serial.write(0x7D); // Digit 3 Individual Segment Control Serial.write(0b01111111); // All segments are ON Serial.write(0x77); // Command for decimal point Serial.write(0x04); // Display read out decimal point digit 3 delay(500); // Time for Display read out Serial.write(0x77); // Command for decimal point Serial.write(0x20); // Display read out Apostrophe delay(500); // Time for Display read out Serial.write(0x7E); // Digit 4 Individual Segment Control Serial.write(0b00000001); // Segment 1 are ON delay(500); // Time for Display read out Serial.write(0x7E); // Digit 4 Individual Segment Control Serial.write(0b00000010); // Segment 2 are ON delay(500); // Time for Display read out Serial.write(0x7E); // Digit 4 Individual Segment Control Serial.write(0b00000100); // Segment 3 are ON delay(500); // Time for Display read out Serial.write(0x7E); // Digit 4 Individual Segment Control Serial.write(0b00001000); // Segment 4 are ON delay(500); // Time for Display read out Serial.write(0x7E); // Digit 4 Individual Segment Control Serial.write(0b00010000); // Segment 5 are ON delay(500); // Time for Display read out Serial.write(0x7E); // Digit 4 Individual Segment Control Serial.write(0b00100000); // Segment 6 are ON delay(500); // Time for Display read out Serial.write(0x7E); // Digit 4 Individual Segment Control Serial.write(0b01000000); // Segment 7 are ON delay(500); // Time for Display read out Serial.write(0x7E); // Digit 4 Individual Segment Control Serial.write(0b01111111); // All segments are ON Serial.write(0x77); // Command for decimal point Serial.write(0x08); // Display read out decimal point digit 4 delay(500); // Time for Display read out }