hi
i'm trying to display my ip address on a 4 digit 7segment. I've managed to scroll the numbers correctly but I can't seem to find a way to display the decimal point which divides the octets. here is my code:
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <WiFi.h>
//Pin connected to RCLK(latch pin)
int latchPin = 4;
//Pin connected to SCLK(clock pin)
int clockPin = 3;
////Pin connected to DIO(data input/output)
int dataPin = 2;
int digits[5]={0x00,0x80,0x40,0x20,0x10};//array to define digit adresses
int numbers[10]={0x03,0x9F,0X25,0X0D,0X99,0X49,0X41,0X1F,0X01,0X09};//array to define numbers
/*IPAddress myIP = WiFi.localIP();
myIP[0]=192;
myIP[1]=168;
myIP[2]=0;
myIP[3]=1;*/
int IPdigits[10];
IPAddress myIP = IPAddress(192, 168, 0, 1);
void setup() {
//configuring control pins as output
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
Serial.begin(9600);
// start deviding IP octets into individual numbers
IPdigits[2]=int(myIP[0])%10; //2
IPdigits[1]=(int(myIP[0])/10)%10; //9
IPdigits[0]=(int(myIP[0])/100)%10;//1
IPdigits[5]=int(myIP[1])%10; //8
IPdigits[4]=(int(myIP[1])/10)%10; //6
IPdigits[3]=(int(myIP[1])/100)%10;//1
IPdigits[6]=int(myIP[2]); //0
IPdigits[9]=int(myIP[3])%10; //3
IPdigits[8]=(int(myIP[3])/10)%10; //3
IPdigits[7]=(int(myIP[3])/100)%10;//0
// Serial.println(IPdigits[0]);
// Serial.println(IPdigits[1]);
// Serial.println(IPdigits[2]);
// Serial.println(IPdigits[3]);
// Serial.println(IPdigits[4]);
// Serial.println(IPdigits[5]);
// Serial.println(IPdigits[6]);
// Serial.println(IPdigits[7]);
// Serial.println(IPdigits[8]);
// Serial.println(IPdigits[9]);
}
void loop() {
scroll_IP();
}
void scroll_IP() {
for (int i=0 ; i<7 ; i++) {
for (int j=0 ; j<100 ; j++){
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, numbers[IPdigits[i]]);
shiftOut(dataPin, clockPin, LSBFIRST, digits[1]);
digitalWrite(latchPin, HIGH);
delay(2);
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, numbers[IPdigits[i+1]]);
shiftOut(dataPin, clockPin, LSBFIRST, digits[2]);
digitalWrite(latchPin, HIGH);
delay(2);
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, numbers[IPdigits[i+2]]);
shiftOut(dataPin, clockPin, LSBFIRST, digits[3]);
digitalWrite(latchPin, HIGH);
delay(2);
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, numbers[IPdigits[i+3]]);
shiftOut(dataPin, clockPin, LSBFIRST, digits[4]);
digitalWrite(latchPin, HIGH);
delay(2);
}
}
}
void blank_display() { //blanks out the display
digitalWrite(latchPin, LOW); //|
shiftOut(dataPin, clockPin, LSBFIRST, 0b11111111); //>> blank out display
shiftOut(dataPin, clockPin, LSBFIRST, 0b00000000); //|
digitalWrite(latchPin, HIGH);
}