A
Arduino•3mo ago
myzstral

Apparently my code's useless. Let's improve it.

141 Replies
myzstral
myzstralOP•3mo ago
// C++ code
//
void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
digitalWrite(6, 1);
digitalWrite(7, 1);
digitalWrite(8, 1);
digitalWrite(9, 1);
digitalWrite(10, 1);
digitalWrite(11, 1);
digitalWrite(12, 0);
digitalWrite(3, 1);
}

void loop()
{

delay(1000);
}
// C++ code
//
void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
digitalWrite(6, 1);
digitalWrite(7, 1);
digitalWrite(8, 1);
digitalWrite(9, 1);
digitalWrite(10, 1);
digitalWrite(11, 1);
digitalWrite(12, 0);
digitalWrite(3, 1);
}

void loop()
{

delay(1000);
}
thats my code tbh all i want it to do is literally power pin 3 up and make all the common cathodes of all digits except 1 so they dont light up powering pin 3 goes through my binary decoder and translates it to wire 8 which is supposed to power the . in the last digit. when i directly short pin 3 to VCC of arduino the . lights up without issue but when i use "1" and power it with code the chips go broken oh that yeah it probably just kept re-writing the same thing and lagged it out. so i am asking, why do the chips get broken only when powered with code. direct circuit short works fine. remixing :P possibly. its misbehaving. so i either have to switch to real hardware or just use another sim? why do you think i do not know what i am doing? i am pretty new to multiplexing, if i am being honest. but im pretty sure i know what i'll do, considering i have built clocks before. what i am doing this time is just adding ms digits to it and multiplexing in an effort to manage to use an arduino UNO when i build it physically, even with more pins to manage from the segment displays. well, maybe. but this thing is just something really unoptimized i am using to test out my wiring. though, you really helped. thank you for it.
Coder_DO_As_Impossible
Sorry, I was out for a work. What's the update? @myzstral https://discord.com/channels/420594746990526466/451155251580633089/1391361219276967936 I got your response, but I don't understand the usage of 3 AND Gate ICs
myzstral
myzstralOP•3mo ago
its used for my multiplexer iirc i gave u a link to the multiplexer i took insipration from https://discord.com/channels/420594746990526466/451155251580633089/1391362186101653548
DarwinWasWrong
DarwinWasWrong•3mo ago
Do we have a link to diagram or emulation?
myzstral
myzstralOP•3mo ago
^^^ check that link and you'll see what the AND gates are for i forgot to add it, sorry adding it rn
myzstral
myzstralOP•3mo ago
i cant pin it :/
Coder_DO_As_Impossible
Ok, I got it, but I don't understand then the usage of HEX decoder.
myzstral
myzstralOP•3mo ago
its used as NOT gates
DarwinWasWrong
DarwinWasWrong•3mo ago
Have you tested one digit by itself ? Without multiplex
Coder_DO_As_Impossible
Hmm...
myzstral
myzstralOP•3mo ago
wdym one digit itself it does work like as i said even with multiplex direct short circuit through a resistor to arduino's 5v works but when i send the signal from the arduino through code, even with the resistors, the chips break its probably the sim just misbihaving
DarwinWasWrong
DarwinWasWrong•3mo ago
In real life ? nope ok That is on VERY hard cirduit to trace....
myzstral
myzstralOP•3mo ago
either because of my horrible wiring or the multiplexer that has a few million wires connected to it yes
myzstral
myzstralOP•3mo ago
i mean it does work even though it shows the chips "broken"
No description
myzstral
myzstralOP•3mo ago
i mean i tried making it as easy as possible by using as much colours for wires as possible
Coder_DO_As_Impossible
@myzstral Redo the wiring work, neatly and send the updates here. If I am not, then Darwin will surely help
myzstral
myzstralOP•3mo ago
it probably has no wiring issues other than some wires going on top of eachother and hiding the ones underneath i tried to make it as clean as possible. i dont even know how to make it cleaner anymore tho i will try
Coder_DO_As_Impossible
Send each and every update so that you are supervised and all of us will get to know the output.
myzstral
myzstralOP•3mo ago
okay
Coder_DO_As_Impossible
Both are almost similar
myzstral
myzstralOP•3mo ago
this is what i mean by overlaid wires
myzstral
myzstralOP•3mo ago
at first you're like... "yep thats defo a single gray wire" then you pull it up and go "it was 2... wires?" then you pull it up once more and go "3 WIRES!?"
Coder_DO_As_Impossible
Well, I wont be available for 2hrs straight from now, if I can then I'll keep checking. Either Darwin or nis will help. So Good Luck with it.
myzstral
myzstralOP•3mo ago
not sure if i'll be on for 2 hours ben here for a few hours already eh
DarwinWasWrong
DarwinWasWrong•3mo ago
@myzstral why - really why - do you have a resistor on the 5v rail from the ardiono
myzstral
myzstralOP•3mo ago
basically it was burning the ICs at one point
DarwinWasWrong
DarwinWasWrong•3mo ago
take it off...
myzstral
myzstralOP•3mo ago
and tinkercad was showing "ICs need 833mV" then i calculated a resistance to drop 5v to 833mV and it stopped for a while sure that resistor was the culprit wow amazing. a single resistor making me suffer for hours. thanks darwin
DarwinWasWrong
DarwinWasWrong•3mo ago
When you are running and it show the blown up thing - hover over it It tells you what is causing it
myzstral
myzstralOP•3mo ago
i did hover it yes at one point it said the ICs were overloaded
DarwinWasWrong
DarwinWasWrong•3mo ago
And it said 5v is over the 2.33 VCC
myzstral
myzstralOP•3mo ago
( prolly an input ) but i messed it up and changed the input to the chip it did fix it not for long tho it says diff stuff at diff times lol
DarwinWasWrong
DarwinWasWrong•3mo ago
You are also overloading the arduino pins I read the message.
DarwinWasWrong
DarwinWasWrong•3mo ago
No description
DarwinWasWrong
DarwinWasWrong•3mo ago
Which is where one ponders - why is VCC 2.42 V The next step is the inclusion of resistors on the common pins of the display
DarwinWasWrong
DarwinWasWrong•3mo ago
No description
DarwinWasWrong
DarwinWasWrong•3mo ago
The rest of the rats nest - I am unsure of Well the code aint much
myzstral
myzstralOP•3mo ago
uh i updated my circuit a bit did this and also i updated the code a bit to send all 8 binary values to see if the segments work properly in all digits
// C++ code
//
void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);

}

void loop()
{
for(int i=0;i<7;i++){
digitalWrite(6, 1);
digitalWrite(7, 1);
digitalWrite(8, 1);
digitalWrite(9, 1);
digitalWrite(10, 1);
digitalWrite(11, 1);
digitalWrite(12, 1);
digitalWrite(i, 0);
for(int j=0;j<8;j++){
int n = j;

int b2 = (n >> 2) & 1;
int b1 = (n >> 1) & 1;
int b0 = n & 1;

digitalWrite(2, b2);
digitalWrite(3, b1);
digitalWrite(4, b0);
delay(1000);
}
delay(1000);
digitalWrite(i, 1);
}
}
// C++ code
//
void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);

}

void loop()
{
for(int i=0;i<7;i++){
digitalWrite(6, 1);
digitalWrite(7, 1);
digitalWrite(8, 1);
digitalWrite(9, 1);
digitalWrite(10, 1);
digitalWrite(11, 1);
digitalWrite(12, 1);
digitalWrite(i, 0);
for(int j=0;j<8;j++){
int n = j;

int b2 = (n >> 2) & 1;
int b1 = (n >> 1) & 1;
int b0 = n & 1;

digitalWrite(2, b2);
digitalWrite(3, b1);
digitalWrite(4, b0);
delay(1000);
}
delay(1000);
digitalWrite(i, 1);
}
}
this is the code
DarwinWasWrong
DarwinWasWrong•3mo ago
void setup()
{
for ( int x=2; x< 13;x++)
{
pinMode(x,OUTPUT);
}

void setup()
{
for ( int x=2; x< 13;x++)
{
pinMode(x,OUTPUT);
}

myzstral
myzstralOP•3mo ago
i'll do that it didnt light the segments up
DarwinWasWrong
DarwinWasWrong•3mo ago
It is just the pin mode - it wold not affect any other code IS this an exercise ? like test or something - I am unsure why you are not just using a controller chip
myzstral
myzstralOP•3mo ago
sorry my internet crashed while i was explaining so i put leds to test my binary output code it did work but the segments arent lighting up well i like understanding how things work and doing them myself :P
DarwinWasWrong
DarwinWasWrong•3mo ago
How are you turning each digit on ? <wanders off in a daze>
AnonEngineering
AnonEngineering•3mo ago
yummm, coffee...
myzstral
myzstralOP•3mo ago
I have the commons seperated. So i power the common of the digit i want on. I iterate through the commons fast so you dont notice it. ( this is js what i plan, havent programmed it yet )
AnonEngineering
AnonEngineering•3mo ago
Which is a good plan, but in a real circuit you need to remember that if all the segments are on the common pin needs to sink or source ~80mA, more than a pin can handle. Usually you use a transistor on each digits common pin.
myzstral
myzstralOP•3mo ago
A sink is like an electrically powered switch rgt? Like i send a small current to it and it allows a larger current connected to it pass thru, right? I thought it was called a relay for some reason
AnonEngineering
AnonEngineering•3mo ago
yes, the transistor acts like a switch (a relay is also a switch but it's too slow for this application) you'd "sink" current for a common cathode display, you'd "source" current for a common anode display (in my simulation like the transistors aren't there, Wokwi doesn't simulate current)
DarwinWasWrong
DarwinWasWrong•3mo ago
anode or cathode ?
AnonEngineering
AnonEngineering•3mo ago
glad I didn't wait for a response, drove 750km since that answer šŸ™‚
DarwinWasWrong
DarwinWasWrong•3mo ago
The wiring is lacklustre, needs work. Given its a virtual environment use more bread boards to spread it out.
myzstral
myzstralOP•3mo ago
:P sure i am rebuilding my circuit in wokwi issue is it has gates and not actual hardware so i cannot ditermine what components to get when i am done lol uh so back to tinkercad? idk i might build on both
AnonEngineering
AnonEngineering•3mo ago
the decoder uses which chips, i can't read the diagram above AND gates and inverters?
myzstral
myzstralOP•3mo ago
yeah and gates and not gates
AnonEngineering
AnonEngineering•3mo ago
wokwi has both of them (as gates)
myzstral
myzstralOP•3mo ago
yes thats the problem lol i said it has gates and not chips its not exactly a problem
AnonEngineering
AnonEngineering•3mo ago
why? inside <whatever chip> are gates
myzstral
myzstralOP•3mo ago
forget it
AnonEngineering
AnonEngineering•3mo ago
it will be a wiring nightmare šŸ˜‰ does Tinker have the chips you are using?
myzstral
myzstralOP•3mo ago
yes
AnonEngineering
AnonEngineering•3mo ago
Tinker does have 74HC21 which would make it a little easier to wire...
myzstral
myzstralOP•3mo ago
i am rewiring everything
No description
myzstral
myzstralOP•3mo ago
to make it clear, hopefully i am using diff breadboards for diff stuff and sort the inputs and outputs to one place this time
AnonEngineering
AnonEngineering•3mo ago
why 9 digits? maybe start with 4 just to prove the point or 1 digit, get the 3 of 8 decoder working first
myzstral
myzstralOP•3mo ago
i'll only be testing out with one digit till i get it right
myzstral
myzstralOP•3mo ago
progress update
No description
myzstral
myzstralOP•3mo ago
the chip wiring might still be messy but meh the wires connected to the breadboard arent messy atleast
AnonEngineering
AnonEngineering•3mo ago
with that many gates it'll never be super neat, but try your best to not overlap wires that does look better
myzstral
myzstralOP•3mo ago
quick question: was color coding those wires a good idea, or a bad one?
AnonEngineering
AnonEngineering•3mo ago
may actually be better to not use a breadboard IRL you'd have the advantage of a multilayer PCB color coding is a good idea, i always use red for power, black for ground, then pick colors that make sense to you for inputs / outputs
myzstral
myzstralOP•3mo ago
yeah lol same
AnonEngineering
AnonEngineering•3mo ago
good luck on your quest, since the '70's i just cheat and use a CD4511 šŸ™‚
myzstral
myzstralOP•3mo ago
as i mentioned, i like learning how things work and implementing it on my own :P though im not sure if this thread should be in coding help lol
AnonEngineering
AnonEngineering•3mo ago
yes, a worthy task eh, maybe hardware would have been better but just leave it here now
myzstral
myzstralOP•3mo ago
done with the gate wiring
No description
myzstral
myzstralOP•3mo ago
i am planning on switching to hardware really soon, actually. last time i built a clock i built v1 on hardware then made it in tinkercad to make "improvements" and "add features" which never happened enough staring today. my eyes are already dead enough rest tomorrow, or later. thank you for your help, anon farewell.
myzstral
myzstralOP•3mo ago
wired the commons as well, before i forgot
No description
myzstral
myzstralOP•3mo ago
bye now
Coder_DO_As_Impossible
I really respect your dedication. You took your own time to make a circuit to help someone. 🫔
AnonEngineering
AnonEngineering•3mo ago
and I haven't played with discrete gates in forever šŸ˜‰
Coder_DO_As_Impossible
respect*100
myzstral
myzstralOP•3mo ago
Very much appriacted. My greatest gratitude to you, anon
AnonEngineering
AnonEngineering•3mo ago
you're welcome, it was a fun exercise šŸ˜‰ (still a wiring nightmare šŸ™‚ )
myzstral
myzstralOP•3mo ago
Lol šŸ‘
AnonEngineering
AnonEngineering•3mo ago
i just had to do it šŸ™‚ , this is very ugly but it works https://www.tinkercad.com/things/5CSH4tGoAZV-3of8decoderdemo Now to extrapolate that out to 8 or 9 digits... two words - shift registers šŸ™‚
DarwinWasWrong
DarwinWasWrong•3mo ago
@AnonEngineering there just isn't any way to make that pretty....
AnonEngineering
AnonEngineering•3mo ago
PCB šŸ™‚
DarwinWasWrong
DarwinWasWrong•3mo ago
Next they OP will be using transistors for the gates.... https://electronixandmore.com/projects/pong/index.html This entire Analog TV Pong Game is built using only ten CD4001 quad NOR and three CD4011 quad NAND ICs
myzstral
myzstralOP•3mo ago
you tell me, in this specific case, which is better? Transistors or ICs? "its not stupid if it works" :P
DarwinWasWrong
DarwinWasWrong•3mo ago
IC's are just a collection of transistors. Since you are drilling down, not using control chip but using individual chips etc. The next step into the darkness is using transistors to make the logic you are using, instead of chips.
myzstral
myzstralOP•3mo ago
oh alright
myzstral
myzstralOP•3mo ago
why are all lights on?
DarwinWasWrong
DarwinWasWrong•3mo ago
But no bodies home ?
myzstral
myzstralOP•3mo ago
good one, but for real, why?
AnonEngineering
AnonEngineering•3mo ago
74HC10 are NAND gates, so when all the inputs are LOW the output is HIGH
myzstral
myzstralOP•3mo ago
so i foolishly put NAND gates instead of AND thanks to my "different" wiring this time shuold be ez
myzstral
myzstralOP•3mo ago
No description
myzstral
myzstralOP•3mo ago
what can i do?
No description
No description
Coder_DO_As_Impossible
Its 7411 right?
myzstral
myzstralOP•3mo ago
yeah
myzstral
myzstralOP•3mo ago
nvm tho i fixed it with resistors
No description
Coder_DO_As_Impossible
That's good
myzstral
myzstralOP•3mo ago
// C++ code
//
#include <Arduino.h>

struct Bin3 {
byte a, b, c;
};

void setup()
{
for(int i=2;i<13;i++){
pinMode(i, OUTPUT);
}
}

void loop()
{
number(2);
}

Bin3 binary(byte n) {
return {
(n >> 2) & 1,
(n >> 1) & 1,
n & 1
};
}

void number(int n){
switch(n){
case 1:
for(int i=1;i<3;i++){
Bin3 bits = binary(i);

digitalWrite(2, bits.a);
digitalWrite(3, bits.b);
digitalWrite(4, bits.c);
delay(100);
}
break;
case 2:
for(int i=0;i<8;){
Bin3 bits = binary(i);

digitalWrite(2, bits.a);
digitalWrite(3, bits.b);
digitalWrite(4, bits.c);
delay(100);
switch(i){
case 0:
i++;
break;
case 1:
i+=2;
break;
case 3:
i++;
break;
case 4:
i+=2;
break;
default:
i++;
break;
}
}
break;
}
}
// C++ code
//
#include <Arduino.h>

struct Bin3 {
byte a, b, c;
};

void setup()
{
for(int i=2;i<13;i++){
pinMode(i, OUTPUT);
}
}

void loop()
{
number(2);
}

Bin3 binary(byte n) {
return {
(n >> 2) & 1,
(n >> 1) & 1,
n & 1
};
}

void number(int n){
switch(n){
case 1:
for(int i=1;i<3;i++){
Bin3 bits = binary(i);

digitalWrite(2, bits.a);
digitalWrite(3, bits.b);
digitalWrite(4, bits.c);
delay(100);
}
break;
case 2:
for(int i=0;i<8;){
Bin3 bits = binary(i);

digitalWrite(2, bits.a);
digitalWrite(3, bits.b);
digitalWrite(4, bits.c);
delay(100);
switch(i){
case 0:
i++;
break;
case 1:
i+=2;
break;
case 3:
i++;
break;
case 4:
i+=2;
break;
default:
i++;
break;
}
}
break;
}
}
3:1: error: 'Bin3' does not name a type; did you mean 'sinf'?



3:0:
3:1: error: 'Bin3' does not name a type; did you mean 'sinf'?



3:0:
i keep getting this error, why?
Coder_DO_As_Impossible
try defining them first before the setup. like Bin3 binary(byte n); and void number(int n);
myzstral
myzstralOP•3mo ago
okay
// C++ code
//
#include <Arduino.h>

struct Bin3 {
byte a, b, c;
};

Bin3 binary(byte n) {
return {
(n >> 2) & 1,
(n >> 1) & 1,
n & 1
};
}

void number(int n){
switch(n){
case 1:
for(int i=1;i<3;i++){
Bin3 bits = binary(i);

digitalWrite(2, bits.a);
digitalWrite(3, bits.b);
digitalWrite(4, bits.c);
delay(100);
}
break;
case 2:
for(int i=0;i<8;){
Bin3 bits = binary(i);

digitalWrite(2, bits.a);
digitalWrite(3, bits.b);
digitalWrite(4, bits.c);
delay(100);
switch(i){
case 0:
i++;
break;
case 1:
i+=2;
break;
case 3:
i++;
break;
case 4:
i+=2;
break;
default:
i++;
break;
}
}
break;
}
}

void setup()
{
for(int i=2;i<13;i++){
pinMode(i, OUTPUT);
}
}

void loop()
{
number(2);
}
// C++ code
//
#include <Arduino.h>

struct Bin3 {
byte a, b, c;
};

Bin3 binary(byte n) {
return {
(n >> 2) & 1,
(n >> 1) & 1,
n & 1
};
}

void number(int n){
switch(n){
case 1:
for(int i=1;i<3;i++){
Bin3 bits = binary(i);

digitalWrite(2, bits.a);
digitalWrite(3, bits.b);
digitalWrite(4, bits.c);
delay(100);
}
break;
case 2:
for(int i=0;i<8;){
Bin3 bits = binary(i);

digitalWrite(2, bits.a);
digitalWrite(3, bits.b);
digitalWrite(4, bits.c);
delay(100);
switch(i){
case 0:
i++;
break;
case 1:
i+=2;
break;
case 3:
i++;
break;
case 4:
i+=2;
break;
default:
i++;
break;
}
}
break;
}
}

void setup()
{
for(int i=2;i<13;i++){
pinMode(i, OUTPUT);
}
}

void loop()
{
number(2);
}
1:1: error: 'Bin3' does not name a type; did you mean 'sinf'?



3:0:
154:6: error: conflicting declaration of 'void setup()' with 'C' linkage


3:6: note: previous declaration with 'C++' linkage


3:0:
155:6: error: conflicting declaration of 'void loop()' with 'C' linkage


4:6: note: previous declaration with 'C++' linkage
1:1: error: 'Bin3' does not name a type; did you mean 'sinf'?



3:0:
154:6: error: conflicting declaration of 'void setup()' with 'C' linkage


3:6: note: previous declaration with 'C++' linkage


3:0:
155:6: error: conflicting declaration of 'void loop()' with 'C' linkage


4:6: note: previous declaration with 'C++' linkage
huh
Coder_DO_As_Impossible
I meant smth else
// C++ code
//
#include <Arduino.h>

struct Bin3 {
byte a, b, c;
};

Bin3 binary(byte n);
void number(int n);

void setup()
{
for(int i=2;i<13;i++){
pinMode(i, OUTPUT);
}
}

void loop()
{
number(2);
}

Bin3 binary(byte n) {
return {
(n >> 2) & 1,
(n >> 1) & 1,
n & 1
};
}

void number(int n){
switch(n){
case 1:
for(int i=1;i<3;i++){
Bin3 bits = binary(i);

digitalWrite(2, bits.a);
digitalWrite(3, bits.b);
digitalWrite(4, bits.c);
delay(100);
}
break;
case 2:
for(int i=0;i<8;){
Bin3 bits = binary(i);

digitalWrite(2, bits.a);
digitalWrite(3, bits.b);
digitalWrite(4, bits.c);
delay(100);
switch(i){
case 0:
i++;
break;
case 1:
i+=2;
break;
case 3:
i++;
break;
case 4:
i+=2;
break;
default:
i++;
break;
}
}
break;
}
}
// C++ code
//
#include <Arduino.h>

struct Bin3 {
byte a, b, c;
};

Bin3 binary(byte n);
void number(int n);

void setup()
{
for(int i=2;i<13;i++){
pinMode(i, OUTPUT);
}
}

void loop()
{
number(2);
}

Bin3 binary(byte n) {
return {
(n >> 2) & 1,
(n >> 1) & 1,
n & 1
};
}

void number(int n){
switch(n){
case 1:
for(int i=1;i<3;i++){
Bin3 bits = binary(i);

digitalWrite(2, bits.a);
digitalWrite(3, bits.b);
digitalWrite(4, bits.c);
delay(100);
}
break;
case 2:
for(int i=0;i<8;){
Bin3 bits = binary(i);

digitalWrite(2, bits.a);
digitalWrite(3, bits.b);
digitalWrite(4, bits.c);
delay(100);
switch(i){
case 0:
i++;
break;
case 1:
i+=2;
break;
case 3:
i++;
break;
case 4:
i+=2;
break;
default:
i++;
break;
}
}
break;
}
}
Try this
AnonEngineering
AnonEngineering•3mo ago
just 'cuz I'm stuck on shift registers šŸ˜‰ https://wokwi.com/projects/435918308931774465
myzstral
myzstralOP•2mo ago
sorry for no updates had some exams works, thanks
myzstral
myzstralOP•2mo ago
binary decoder arduino 0001 - Wokwi ESP32, STM32, Arduino Simulator
Run IoT and embedded projects in your browser: ESP32, STM32, Arduino, Pi Pico, and more. No installation required!
myzstral
myzstralOP•2mo ago
remaking my tinkercad circuit ( which works lol - can display digits ) in wokwi because the sim runs slowly but the switches seem to glitch and mess up the signals? and some signals arent outputting what they're supposed to output restarting the sim fixes it i hope that doesn't happen on arduino though
Coder_DO_As_Impossible
Thats good to hear.
myzstral
myzstralOP•2mo ago
what?
DarwinWasWrong
DarwinWasWrong•2mo ago
@myzstral put a delay in your loop
myzstral
myzstralOP•2mo ago
i will lol , i js did that to see the digits properly cause the sim slowness only showed me a single segment at a time Hes talking about my tinkercad one Also whats wrong w em in wokwi Am I short circuiting the positive and negative when the switches are to the left?
DarwinWasWrong
DarwinWasWrong•2mo ago
yes
DarwinWasWrong
DarwinWasWrong•2mo ago
@myzstral
No description
DarwinWasWrong
DarwinWasWrong•2mo ago
fast way to fix in diagam.json fast way to fix in diagam.json search and replace
:3",
:3",
with
:2",
:2",
in the connections section then change
[ "vcc1:VCC", "sw1:2", "red", [ "v0", "h28.8" ] ],
[ "vcc1:VCC", "sw2:2", "red", [ "v0", "h67.2" ] ],
[ "vcc1:VCC", "sw3:2", "red", [ "v0", "h105.6" ] ],
[ "vcc1:VCC", "sw1:2", "red", [ "v0", "h28.8" ] ],
[ "vcc1:VCC", "sw2:2", "red", [ "v0", "h67.2" ] ],
[ "vcc1:VCC", "sw3:2", "red", [ "v0", "h105.6" ] ],
to
[ "vcc1:VCC", "sw1:3", "red", [ "v0", "h28.8" ] ],
[ "vcc1:VCC", "sw2:3", "red", [ "v0", "h67.2" ] ],
[ "vcc1:VCC", "sw3:3", "red", [ "v0", "h105.6" ] ],
[ "vcc1:VCC", "sw1:3", "red", [ "v0", "h28.8" ] ],
[ "vcc1:VCC", "sw2:3", "red", [ "v0", "h67.2" ] ],
[ "vcc1:VCC", "sw3:3", "red", [ "v0", "h105.6" ] ],
AnonEngineering
AnonEngineering•2mo ago
i've gotten half decent editing the json, easier than removing / re-adding wires šŸ˜‰
myzstral
myzstralOP•2mo ago
binary decoder arduino 0001 - Wokwi ESP32, STM32, Arduino Simulator
Run IoT and embedded projects in your browser: ESP32, STM32, Arduino, Pi Pico, and more. No installation required!
myzstral
myzstralOP•2mo ago
why does it glitch out, even with arduino? like it skips the 3rd segment and stuff
AnonEngineering
AnonEngineering•2mo ago
to start, this is no good...
No description
AnonEngineering
AnonEngineering•2mo ago
some of the glitching is due to a lack of an enable input, mostly it's wiring I have a working example, let me know if you'd like to see it (wish there was a quad input AND gate, really stacking the 2 input jobs šŸ™‚ )
myzstral
myzstralOP•2mo ago
Sure
AnonEngineering
AnonEngineering•2mo ago
this adds another AND gate to enable / disable the outputs to prevent glitching and uses bit shifting to shuffle the A B C bits https://wokwi.com/projects/436657000602027009 more than one way to skin a cat šŸ˜‰ @myzstral i omitted the resistors for clarity, in a real circuit each LED will need one
myzstral
myzstralOP•2mo ago
pretty sure i'm not gonna need that when i switch to irl components tho i'm gonna switch soon for now i rewired and i can atleast see the things working ( with a bit of glitching but meh ) since i have 9 digits i'm unfortunately going to have to make another multiplexer for the digits ( i love my ideas - sarcasm ) thanks to my geniusness of adding 3 switches which werent necessary i dont have to wire for 30 minutes again ;P i love copy pasting
myzstral
myzstralOP•2mo ago
No description
myzstral
myzstralOP•2mo ago
i know i should have used NAND gates instead of sending AND through NOT ( which is the same thing ) but i was too lazy to wire everything again
AnonEngineering
AnonEngineering•2mo ago
i'd be interested to see the project link here's a bodge to get the 3 to 8 to count up (what's one more AND gate) https://wokwi.com/projects/436784374695414785
myzstral
myzstralOP•2mo ago
Same as the previous link, i update the same thing. I dont understand why my code works in tinkercad but not in wokwi lol
AnonEngineering
AnonEngineering•2mo ago
not sure why the switches are still there, but they need to all be flipped down then it starts to work but the patterns are all wrong, not sure why, the lower AND gates seem like they are wired correctly It works better if i disconnect the other 8 digits and ground the single digit, but it seems there is a logic error in your code
myzstral
myzstralOP•2mo ago
Worked in tinkercad but i'll check
DarwinWasWrong
DarwinWasWrong•2mo ago
maybe a link to your project would make the fault finding a little quicker.
myzstral
myzstralOP•2mo ago
I had sent it But sure will resend
myzstral
myzstralOP•2mo ago
binary decoder arduino 0001 - Wokwi ESP32, STM32, Arduino Simulator
Run IoT and embedded projects in your browser: ESP32, STM32, Arduino, Pi Pico, and more. No installation required!
myzstral
myzstralOP•2mo ago
I unfortunately cannot pin it
MaderDash
MaderDash•2mo ago
@š“†©š–’š–žš–Ÿš–˜š–™š–—š–†š–‘š“†Ŗ please fix your user name
myzstral
myzstralOP•4w ago
you can type it as @myzstral and it pings me also i'm not aware if it's against the rules let me check rule 9 and 3, got it. its fine if i change it in just this server, right? well now i've gone through all the rules, i guess. ah sorry i couldnt update the project exams are coming and i am busy nowadays im looking forward to continue the project again once i get my hands on hardware components got caught up in a software project abandoned ( for now ) will try to continue soon

Did you find this page helpful?