i decided to go for it..a learning process, rather than buying a ready made board or kit.
i built me a 4 digit 7-seg display..2.3" tall
i am looking for some demo code to try, to see that i have the display built correctly.
i'm not 100% sure which digit should get the SER input.. the far right or far left digit..
a simple count up code would be fine 0-9999 some thing faster then 1 sec per count..lol
maybe 4 or 5 CPS ?
cardinalflyer >> thanks.. i already have one of these boards working in a GPS clock, 6 digits 10" tall..
works great. but i took it apon myself to build me a smaller unit that i will later be turning into
a 4 digit thermometer, using a DHT22 sensor.
i wanted the experience to build my own driver board. it was not nearly as hard as i had thought it to be.
i just wanted some test code to make sure display was working correctly 1st..
i still am unclear as to which digit gets the serial input 1st. the far right or far left..
i guess i'll fine out when i test it..
hi again.. i looked at the hook up diagram sparksfun was using.. i am assuming the pin out is the same on the nano's
i'm double checking my connections, but i get nothing on display...i'll check it more tomorrow..
also i have a UNO, it's acting weird.. i can burn the sketch onto the UNO, and the TX led blinks, letting me know
it is working.. but if i unplug it,, it looses it's memory.. i go to plug it back in and it just sits there and does nothing..but if i start serial monitor, it comes to life and counts...any ideas ? defective cpu ?
No.
This is a common complaint and it is never justified. It simply does not happen like you describe. Eventually you find out what has gone wrong and you are too embarrassed to come back and say what it was.
ok, i borrowed a friends UNO.. it burned just fine.. but mine still does it.. once power is removed, it goes dumb.. i burned them both back to back.. his works fine, mine doesn't..
but my nano is ok,,
Grumpy_Mike:
No.
This is a common complaint and it is never justified. It simply does not happen like you describe. Eventually you find out what has gone wrong and you are too embarrassed to come back and say what it was.
That is what normally happens.
hey Grumpy.. i am a newbie, as you can tell, but i am here to tell you i ain't afraid to admit my mistakes. i am learning after all.. but no i am not embarrassed to let ya know it either...
as far as i had figured out with my UNO.. for some reason the program i had on it was looking for serial interaction to make it function. why i do not know.. i didn't write the code, it was something i borrowed,, and my nano didn't care either way... so if you know more, then maybe, you can be NOT so GRUMPY, and help a fella.
NEXT,
OK, i got code working for my project, it seems to be working ok so far, except the temperature has a leading zero, ( 075.2 ) and there is no decimal point either. so my display shows 0752. and, it does not display a negative symbol for the neg. temperatures.. so i am trying to figure that part out...
stay tuned, or feel or if anyone can help.
thanks..
We haven't seen any code, diagram, or pictures yet.
A leading zero can be removed with code.
A negative sign can be added with code.
A decimal point can be added with code, or with a permanent current limiting resistor from the dot segment to ground.
Look at the datasheet for Vf of that dot. It could be a single LED, unlike the other segments.
Leo..
.. so if you know more, then maybe, you can be NOT so GRUMPY, and help a fella.
I thought I did help by telling you what you thought was wrong and could not happen.
Without my trusty crystal ball which is currently out for repair it is the best anyone can do. I had assumed you knew what your code was doing because it was your code.
The quality of the answer can only be as good as the quality of the question.
WaWa >>>
i am going to try to attach my code here.. i don't see how to attach it as a file.. so i am going to copy and paste it here..
the code is not of my doing, a friend started helping me, but went on vacation. i only modified part of the code so that my display would work.
as i stated earlier, i need the function of negative symbol for temps below zero, and the leading zero needs to be blanked, and i think i will hard wire the DP..
thanks for any help..
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTPIN 2 // Pin connected to DHT22 sensor
#define DHTTYPE DHT22
DHT_Unified dht(DHTPIN, DHTTYPE);
uint32_t delayMS;
//GPIO declarations
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
byte segmentClock = 6;
byte segmentLatch = 5;
byte segmentData = 7;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void setup()
{
sensor_t sensor;
pinMode(segmentClock, OUTPUT);
pinMode(segmentData, OUTPUT);
pinMode(segmentLatch, OUTPUT);
digitalWrite(segmentClock, LOW);
digitalWrite(segmentData, LOW);
digitalWrite(segmentLatch, LOW);
// Initialize device
dht.begin();
dht.temperature().getSensor(&sensor);
delayMS = sensor.min_delay / 2000;
}
//Takes a number and displays 2 numbers. Displays absolute value (no negatives)
void showNumber(float value)
{
int number = abs(value); //Remove negative signs and any decimals
//Serial.print("number: ");
//Serial.println(number);
for (byte x = 0 ; x < 4 ; x++)
{
int remainder = number % 10;
postNumber(remainder, false);
number /= 10;
}
//Latch the current segment data
digitalWrite(segmentLatch, LOW);
digitalWrite(segmentLatch, HIGH); //Register moves storage register on the rising edge of RCK
}
//Given a number, or '-', shifts it out to the display
void postNumber(byte number, boolean decimal)
{
// - A
// / / F/B
// - G
// / / E/C
// -. D/DP
#define a 1<<0
#define b 1<<1
#define c 1<<2
#define d 1<<3
#define e 1<<4
#define f 1<<5
#define g 1<<6
#define dp 1<<7
byte segments;
switch (number)
{
case 1: segments = b | c; break;
case 2: segments = a | b | d | e | g; break;
case 3: segments = a | b | c | d | g; break;
case 4: segments = f | g | b | c; break;
case 5: segments = a | f | g | c | d; break;
case 6: segments = a | f | g | e | c | d; break;
case 7: segments = a | b | c; break;
case 8: segments = a | b | c | d | e | f | g; break;
case 9: segments = a | b | c | d | f | g; break;
case 0: segments = a | b | c | d | e | f; break;
case ' ': segments = 0; break;
case 'c': segments = g | e | d; break;
case '-': segments = g; break;
}
if (decimal) segments |= dp;
//Clock these bits out to the drivers
for (byte x = 0 ; x < 8 ; x++)
{
digitalWrite(segmentClock, LOW);
digitalWrite(segmentData, segments & 1 << (7 - x));
digitalWrite(segmentClock, HIGH); //Data transfers to the register on the rising edge of SRCK
}
}
void loop()
{
sensors_event_t event;
int16_t number;
delay(delayMS);
dht.temperature().getEvent(&event);
if (!isnan(event.temperature)) {
showNumber(((event.temperature * 90) / 5) + 320);
}
}