0-9 Segment Counter With CloudX Microcontroller

Introduction: 0-9 Segment Counter With CloudX Microcontroller

In this project we use a seven-segment LED display to count from 0 to 9.

A seven-segment LED display consists of eight LEDs and it is perfect for displaying numbers.
To reduce the number of pins used by the display, all of the anodes or cathodes of the LEDs are connected together and are called common-anode or common-cathode, respectively. For our project we use the common-cathode type. The 8 LEDs are labeled A to G and DP (for the decimal point). For our common cathode module, there is an anode pin for each LED segment. For example, if you want to display the number 4, then you would apply current to segments B, C, F and G. The CloudX Segment Library makes using the 7-segment module easier.

Step 1: Collect These Component

1. CLOUDX MICROCONTROLLER

2. CLOUDX SOFTCARD

3. V3 USB CORD

4. 7 SEGMENT (cathode)

5. JUMPER WIRE

6. 330ohm resistor


Step 2: HARDWARE SET-UP

Follow this step:

connect the:

Pin A of the segment to pin1 of the CloudX

Pin B of the segment to pin2 of the CloudX

Pin DP of the segment to pin3 of the CloudX

Pin C of the segment to pin4 of the CloudX

Pin D of the segment to pin5 of the CloudX

Pin E of the segment to pin6 of the CloudX

Pin F of the segment to pin7 of the CloudX

Pin G of the segment to pin9 of the CloudX

connect the common cathode pin to GND

After the connection, let go for the coding:

download Cloudx IDE here

Step 3: CODING

Copy this Code to CloudX IDE

#include <CloudX\M633.h>
#include <CloudX\Segment.h>
 
 char NumberOfDigit = 1; // set number of 7 segment displays to be used
// connect these CloudX pins to the Data Pins A,B,C,D,E,F,G and H pins of the Display
 char segmentDataPins[]= {1, 2, 3, 4, 5, 6, 7, 8};
// connect these CloudX pins to the Common Anode or Cathode of each 7-segment display
 char segmentScanPins[]= 0; // to save pins we connect directly to ground(cathode)


setup(){
 //setup here
 
 // initialize the 7 segment Display with these data
 Segment_setting(CCathode,NumberOfDigit,segmentScanPins,segmentDataPins);
 loop(){
 //Program here
 Segment_write(0 , 1000); // write 0 on 7-segment display for 1 sec
 Segment_write(1 , 1000); // write 1 on 7-segment display for 1 sec
 Segment_write(2 , 1000); // write 2 on 7-segment display for 1 sec
 Segment_write(3 , 1000); // write 3 on 7-segment display for 1 sec
 Segment_write(4 , 1000); // write 4 on 7-segment display for 1 sec
 Segment_write(5 , 1000); // write 5 on 7-segment display for 1 sec
 Segment_write(6 , 1000); // write 6 on 7-segment display for 1 sec
 Segment_write(7 , 1000); // write 7 on 7-segment display for 1 sec
 Segment_write(8 , 1000); // write 8 on 7-segment display for 1 sec
 Segment_write(9 , 1000); // write 9 on 7-segment display for 1 sec
 }
}

Share

    Recommendations

    • Tiny Home Contest

      Tiny Home Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Fix It! Contest

      Fix It! Contest

    Discussions