- Reaction score
- 4,325
Discuss What is the best signal interface for PC ? in the UK Electrical Forum area at ElectriciansForums.net
100Hz not 100kHz! - VERY Interesting that you mention this! This is helpful. So my 1ms delay in code might not be a real 1ms at all. The speed in reality is probably somewhere at 20Hz now that I think about it. Hmmmm... very intriguing. They definitely have some issues on their I2C pins on that arduino board.For most people a refresh rate of 50 to 100Hz fools the eye and brain to see a flicker free image as in a conventional TV picture - but modern TV's may do something different these days.
I counted 7 one millisecond delays, one after the other in this sub-routine. I suppose for now that from the start to end of this sub-routine takes of the order 7mS. I cannot quickly work out if 7mS is to generate a single column of 7 LEDs, a single line of 5 LEDs or all 35 LEDs. Please check my analysis because I am pretty sure I have not completely understood your code. You understand how you have written the code so ought to be able to arrive at figure of about 30Hz or lower which you mentioned earlier.Exactly.
Here is the actual program for 'letter A' that I made and presented in the movie.
You may not understand everything but read the entire program anyway and you will get something out of it. I've also put notes what is line and what is column.
(it was imperative to switch to Input everything after each step, with my custom Reset(); method, otherwise it was liting up the entire next line or column)
Remember a line is HIGH because is +5V and a column is LOW because is 0V. So we lit a single line putting +5V on line01(for ex) and 0v on each desired column.
Code:#include "Arduino.h" //core library that contains all of the Arduino’s built-in functions (from 2022) #include <Adafruit_MCP23X17.h> //this is Adafruit-MCP23017-Arduino-Library version 2.1.0 Adafruit_MCP23X17 mcp1; //Instantiate mcp1 object void setup() { Serial.begin(19200); mcp1.begin_I2C(0x20); for(int i = 0; i <= 15; i++) { mcp1.pinMode(i, INPUT); } for(int i = 0; i <=15; i++) { mcp1.digitalWrite(i, LOW); } //LED MATRIX DISPLAY - Single LED - one by one /* LOGIC: //Columns---------------------------------------- // mcp1.digitalWrite(1, LOW); //A1=1=column A // mcp1.digitalWrite(10, LOW);//B1=10=column B // mcp1.digitalWrite(3, LOW); //A3=3=column C middle // mcp1.digitalWrite(11, LOW);//B2=11=column C middle // mcp1.digitalWrite(4, LOW); //A4=4=column D // mcp1.digitalWrite(13, LOW);//B6=13=column E //Lines---------------------------------------- // mcp1.digitalWrite(5, HIGH);//Line1 // mcp1.digitalWrite(0, HIGH);//Line2 // mcp1.digitalWrite(6, HIGH);//Line3 // mcp1.digitalWrite(2, HIGH);//Line4 // mcp1.digitalWrite(12, HIGH);//Line4 // mcp1.digitalWrite(8, HIGH);//Line5 // mcp1.digitalWrite(14, HIGH);//Line6 // mcp1.digitalWrite(9, HIGH);//Line7 */ } void Reset() { for(int i = 0; i <=15; i++) { mcp1.pinMode(i, INPUT); mcp1.digitalWrite(i, LOW); } } int dly = 1; void chr_A() { //line1 mcp1.pinMode(5, OUTPUT); //line mcp1.digitalWrite(5, HIGH); mcp1.pinMode(10, OUTPUT); //column mcp1.digitalWrite(10, LOW); mcp1.pinMode(3, OUTPUT); //column mcp1.digitalWrite(3, LOW); mcp1.pinMode(4, OUTPUT); //column mcp1.digitalWrite(4, LOW); delay(dly); Reset(); //line2 mcp1.pinMode(0, OUTPUT); //line mcp1.digitalWrite(0, HIGH); mcp1.pinMode(1, OUTPUT); //column mcp1.digitalWrite(1, LOW); mcp1.pinMode(13, OUTPUT); //column mcp1.digitalWrite(13, LOW); delay(dly); Reset(); //line3 mcp1.pinMode(6, OUTPUT); //line mcp1.digitalWrite(6, HIGH); mcp1.pinMode(1, OUTPUT); //column mcp1.digitalWrite(1, LOW); mcp1.pinMode(13, OUTPUT); //column mcp1.digitalWrite(13, LOW); delay(dly); Reset(); //line4-midle mcp1.pinMode(2, OUTPUT); //line mcp1.digitalWrite(2, HIGH); mcp1.pinMode(1, OUTPUT); //column mcp1.digitalWrite(1, LOW); mcp1.pinMode(10, OUTPUT); //column mcp1.digitalWrite(10, LOW); mcp1.pinMode(3, OUTPUT); //column mcp1.digitalWrite(3, LOW); mcp1.pinMode(4, OUTPUT); //column mcp1.digitalWrite(4, LOW); mcp1.pinMode(13, OUTPUT); //column mcp1.digitalWrite(13, LOW); delay(dly); Reset(); //line5 mcp1.pinMode(8, OUTPUT); //line mcp1.digitalWrite(8, HIGH); mcp1.pinMode(1, OUTPUT); //column mcp1.digitalWrite(1, LOW); mcp1.pinMode(13, OUTPUT); //column mcp1.digitalWrite(13, LOW); delay(dly); Reset(); //line6 mcp1.pinMode(14, OUTPUT); //line mcp1.digitalWrite(14, HIGH); mcp1.pinMode(1, OUTPUT); //column mcp1.digitalWrite(1, LOW); mcp1.pinMode(13, OUTPUT); //column mcp1.digitalWrite(13, LOW); delay(dly); Reset(); //line7 mcp1.pinMode(9, OUTPUT); //line mcp1.digitalWrite(9, HIGH); mcp1.pinMode(1, OUTPUT); //column mcp1.digitalWrite(1, LOW); mcp1.pinMode(13, OUTPUT); //column mcp1.digitalWrite(13, LOW); delay(dly); Reset(); } void loop() { chr_A(); }
I do not immediately see the connection between the potential of the outputs and its impact on your time problem.Good morning mister @marconi ,
Here is something interesting... Im not sure how much may have been influenced my program testing so far, I will have to make a more extensive research on this particular detail, but in time. For the momment, with the programs I run already, I didnt really observed much of a difference to be honest. But it crossed my mind that this little bugger might be important in some special cases, special programs. Time will tell.
So here it is - full view:
View attachment 100791
The blue lines represent the Ground or 0V. I marked with a square the 0V marking next to the metalic pad from which the wire is going beneath the cardboard to that long track on which, each negative pin for all the LEDs are connected. So what I have there is a pull down connection through each 12k resistor put in series to each LED to ground.
View attachment 100792
This problem I realize it yesterday, when I was programming and was meditating to the fact those pins from the IC are not really floating or inAir. I then realized they are actually pulled to ground through each led. And today, I mounted that little switch only between this rail for all the leds and 0V. I tested a couple of normal programs but no visible difference. Ill have to test some in depth programs that I have 'somewhere' that really needs some floating pins. I really hope it will be a difference this time. If not, then, daaaaeeem.
First off all, congratulation on the movie and showing the full working project. Very fascinating !!!I do not immediately see the connection between the potential of the outputs and its impact on your time problem.
Reply to What is the best signal interface for PC ? in the UK Electrical Forum area at ElectriciansForums.net
We get it, advertisements are annoying!
Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.