#help-with-arduino
1 messages ยท Page 61 of 1
ah, I see, depends how tilted it is since my surface was not flat
Since the code is trying to use cross-axis values for correction, it seems like mismatches would tend to accumulate.
hhmmm, I'll try re setting those on a flat surface and do another comparison
Worth a try.
however, the accelerometer should rly affect the offset of the initial angle it thinks it's at, it shouldn't rly drift like it does. I'm pretty sure atleast, but I'll give it a try
yeah, it's still drifting a lot ๐ฆ
How can I find out if my csv file (internalFS) has read the last line?
String linee = file.readStringUntil('\n');
At the moment I read each line like this
I tried while(file.available()) { String linee = file.readStringUntil('\n'); Serial.println(linee);
But get an error at the last line
assertion "head >= 2 && head <= lfs->cfg->block_count" failed: file
Arduino15\packages\adafruit\hardware\nrf52\0.20.1\libraries\Adafruit_LittleFS\src\littlefs\lfs.c", line 1144, function: lfs_ctz_find
Okay seems my file was corrupt or something
String linee = file.readStringUntil('\n');
Serial.println(linee);
Serial.println(file.size());
Serial.println(file.position());
Serial.println(file.peek());
if (file.peek() == -1){
break;
file.close();
}
}
Serial.println("EOF");```
This one seems to work
But the weird thing is when I switch break & file.close it's not working. (Loop gets stuck after "EOF")
You might want file.close(); before break otherwise it will never get called.
anyone here who have a ESP32 and some WS2812B neopixels who can help me test and debug my code... it works on my ESP8266 but the ESP32 just wont....
yo guys
i have a question
is it possible to program a sensor to see things and mesure distances between them
NOT BETWEEN THE SENSOR AND THE THINGS
i need this function for a project
and i need to know if it is possbile
To do this, you'd need to identify the objects in an image, compute the angular distance between them, and determine the distances of the objects from the sensor. Using that and some trigonometry, you could compute the distance between the objects.
It may be that the best approach uses multiple sensors (for instance a camera to get an image to identify the objects and their positions, and a distance sensor to measure the distances to the objects).
is that hard ? what do i need exactly ? which sensors ? is there any guides in the net ?
In other words, you might need to measure the distance between the sensor and the things in order to compute the distance between the things.
can i do this with ardublock or mbloc k
It's not super hard. I can't tell you what you need "exactly" as I don't know nearly enough about your problem or other parameters. There are some guides on the net (look up "lidar", and the Primesense Kinect for starters). I know nothing about ardublock nor mblock.
If you know the sizes of the objects, you can use their sizes in the image to compute their distances, instead of using a separate distance sensor.
You might also look at the Pixy2, which can do a lot of the work for you.
It's also possible that you could recognize the objects in a 3D scan (such as with https://www.adafruit.com/product/4010) without a separate camera. It depends on the objects and your situation.
what is the most simple way to do this job
sensors code etc
is this job too much for an arduino uno ?
If you know the sizes of the objects and they're distinctive colours, the easiest way is probably a Pixy2. If you don't, the easiest way is probably OpenCV + Kinect. With a Pixy2, an Arduino is probably sufficient. With OpenCV, you'll probably need something more powerful.
If the objects are smallish and in midair, you might be able to use a LeapMotion to track them.
If you can fit the objects with transponders, there are other possibilities. As with all engineering, "it depends".
Can the Adafruit INA219 breakout board be safely wired to measure the voltage of the arduino's own power supply and current draw of the arduino that the Adafruit INA219 breakout board is connected to, or will it cause some form of short? If it's ok, what would the wiring look like?
Should be fine, just route the input supply through the sensing side.
thanks a lot for ur answers ๐ = )
should i do the measuring distance between people function or think of another one for my project
beacuse i m kind of a newbie ๐
Doing it visually is a fairly advanced project, it doesn't make it impossible for a beginner, but it can be really frustrating when there's so much you have to understand to get something like that working.
ok understood i will think of something else
thanks a lot bro ๐ ๐
do u have any ideas for projects to defeat the coronavirus
prevention *
i need ideas ASAP
Automatic hand desinfection dispenser
Seed studio has a board with a microphone array, used MI to detect coughing and send statistics to a database for Kabana or grafana visuals including direction and frequency. Bit advanced but just throwing stuff at your wall and seeing what sticks
@woven mica that is a pretty awesome idea ! but i did it before....
What do you need it for?
You can do it again (if you do it for school now and didnt before)
i need it for an online competition bro
someone did the idea you said
it is a good idea but someone did it
anyone know an IR library that just gives me raw bit data? without those sony panasonic stuff.
(I just want to send and receive really short data, and want it to be fast because it needs to be responsive.)
im having some issues with fastLED on my esp8266. im using some 5mm APA106 leds and i keep getting weird flickering sometimes. if i use the exact same setup but use a teensy3.6 running the same code it works flawlessly. heres a video of the issue https://www.youtube.com/watch?v=-S0yNgNSI-g and my code ```c
#include <FastLED.h>
#define FASTLED_ALLOW_INTERRUPTS 0
#define DATA_PIN 1
#define LED_TYPE APA106
#define COLOR_ORDER RGB
#define NUM_LEDS 3
CRGB leds[NUM_LEDS];
#define BRIGHTNESS 64
#define FRAMES_PER_SECOND 120
int pos = 0;
int ledBrightness = 0;
boolean isRising = false;
void setup()
{
pinMode(DATA_PIN, OUTPUT);
FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(BRIGHTNESS);
for(int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(0,0,0);
}
delay(5000);
}
void loop()
{
lightTest();
FastLED.show();
FastLED.delay(1000/FRAMES_PER_SECOND);
}
void lightTest()
{
if(pos >= NUM_LEDS)
{
pos = 0;
}
if(ledBrightness >= 255)
{
isRising = false;
}
else if(ledBrightness <= 0)
{
isRising = true;
pos++;
}
if(isRising)
{
ledBrightness++;
}
else
{
ledBrightness--;
}
leds[pos]= CRGB( 0, ledBrightness, 0);
}
@jolly kayak I think its because 3v3 on esp8266 I know teensy also 3v3 but i've seen someone having similar issue with wsxxxx type pixels and logic level change made all the difference I suggest you to use a logic level shifter (single transistor and couple of pull up resistors should do the trick) or use sacrificial pixel method where you'll run first pixel with lower voltage (usually 5V connected to diode connected to pixel) and 1st pixel will amplify your signal to 5V without problem
ive got a 74hc125 but when i use that the leds go crazy
i think it was suggested that the switching on that wasnt fast enough
maybe buffer messes with the timings (I am not sure)
would a 2n7000 nchannel mostfet switch fast enough?
would a 2n7000 nchannel mostfet switch fast enough?
probably good enough
perfect, cus thats all ive got on hand haha. ill give that schematic a try, thanks!
The 74HC125 should work just fine if it's hooked up properly. The transistor with resistor load will be slower.
@north stream any ideas why it might be then?
Power supply wrong? Ground wrong? Ground bounce? OE not enabled?
would a 2n7000 nchannel mostfet switch fast enough?
worst case give the sacrificial pixel a try ๐
im only driving 3 leds at quarter brightness so ive just got it running off of my pc usb, ive got a 1000uF cap as a power filter and decoupling caps on my 3 leds
all my grounds are hooked together like theyre supposed to be
output enable on my level shifter is pulled low
unfortunately not having any luck with the mosfet circuit either
I suspect your problem lies elsewhere.
@north stream probably right, any ideas? ive managed to troubleshoot enough where i dont think its the leds since i got them to work as expected with a teensy and i dont think its the code since its strictly led stuff and no wifi stuff yet so interrupts arent getting in the way
Normally I look for timing issues, but the "leds go crazy" is a symptom of something else, so I'd look for a power supply issue.
the leds only go crazy when i use the level shifter, ill try using the level shifter while on my bench powersupply instead of pc usb
nope, on my bench supply i get the same behavior, i guess i could scope 5v line
You have a scope? Scope the data line and the ground line.
wait, im seeing 5v from the dataline
does the esp8266 output5v i thought it was a 3.3v device
Yeah, something's wrong!
ok so after some fiddling it looks like there was a spike throwing off my scopes auto measurements. after analyzing it a bit thers a peak on the rising edge of my data that goes up to 4.2v then settles out to 3.6v for the top of the wave.
@north stream anything else i should look for on the scope that might help?
Hmm, that spike might be a clue. Maybe you're getting reflections on your data line?
That is a bit of ringing. How long are those data leads?
Or it could be a probe artifact if you're not grounding your scope probe carefully
not too long, a few inches. i just tried wiggling the ground around and changing where the probe is grounded and neither helped
Hm I donโt have enough pins left to use this speaker right?
Woah swiz that looks really cool
i also just made the data line as short as i could make it ~1.5 inches.
thanks capslock, are you talking about the scope or the video of my problem? haha
no worries so what are you trying to do with your project? looks like youve got plenty of IO on your board to drive a speaker
im making this thing! https://twitter.com/jensechu/status/1269785144572940291
Today I coded a dialog system for the #tamagotchi! It is so cute.
It is a little choppy but I can tweak it. Next up is feeding it, then the fishing mini game. ๐ฅฐ
#gamedev #ใใพใใฃใก #ghibli #screenshotsunday https://t.co/r5BICGLjt1
I am not sure because I don't have anymore of the pins that stick out at the bottom
And the connectors for this seem to go to those pins
these guys
sorry hardware anything is not my strong point so I don't know what to call it haha
looks like a uart connector to me, im not sure what board youre using though
Arduino Express Metro M4
oh I do have some uart connectors!
Can I just plug it into the end of these things and into the io slots?
Its a "ICSP" header to be compatible with older arduino UNO shileds. (Even though the M4 doesnt have ICSP its just used for SPI)
wow TIL that would be dope if so
Ahhhh thank you very much. That is so helpful
Oh no
thats not what I meant
I meant the pins that stick up to the right of that in the image that already have wires in them
Yes
thanks iot, im blind and was looking at the plug to the left
Oh cool- I thought you were referring to the thing on the left
Nope, thats looks like a SWD connector
Gotchya!
im wrong again
What interface are you using for your speaker?
So my question is I think that the SWD connector is already full, but it looks like my speaker connects into there
Hmmmm what do you mean by interface? ๐ฆ
I can google it
Ah I have no interface
Are you going directly to an amp with an analog signal or using something like I2S?
I was thinking analog but if there is something better I am open to learning that
Well I find I2S to be better, you spend less CPU time on sound so your processor can do things like update the display
๐ฎ That sounds like what I need then!
If you want to output an analog signal, you need to find which pins on the sides of the airlift have the DAC pins connected. Here is an example I2S amp you would connect between this and a speaker https://www.adafruit.com/product/3006
Np
Note that all the other female pins on the sides have a use ๐ dont just have to use the imitation ICSP header
yeah I am more familiar with those than the ICSP stuff from the uno ๐คฃ
If you wanted to output an analog signal two of the pins should be have a DAC. (But you still need a amp anyways so may as well use I2S)
Is uno capable of I2S I heard it was too slow
Well luckily for him he's using a ATSAMD51 not a ATMEGA328 but you are correct
no theyre apparently really fast
arm is p fast
Dont be sorry, in the picture you can see the M4 label which is the SAMD51
It has been amazing so far
Oh yeah, love them SAMD51s and SAMD21s
i hooked up the level shifter to the scope, it looks like its working no problem, then why are my leds freaking out when the level shifter is their input?
Is that supposed to be a singal to a strip? I see your one pulse but where is the data?
i was just zooming in to make sure the voltages were right, let me get a pic on the rest of the signal
Okay
hmm any tips on getting meaningful info from the scope? otherwise its just a bunch of near identical square waves like that
Hm, that looks off to me but it could be okay. Would you mind just trying the adafruit neopixel library and it's example to rule the software out?
setting up a strand test now
fyi Im playing a game so if I take a sec feel free to @ me
@stuck coral well, looks like theres some sort of issue with fastled, or possibly how im implementing it. i used the neopixel library to recreate my other code as closely as possible and the problem went away
only thing that was a bit annoying is the pins get assigned differently based on what library i use
Oh thats good to hear! Why are the pin assignments different? What chip are you using?
im using an esp 8266, when i use fastled if i point to pin 2 i have to point to pin 14 in neopixel
Ah, got it. Idk about the ESP8266 but on the ESP32 it doesnt matter much which pin due to the muxing
Hi, I am trying to create a countdown timer from 10 seconds. If anyone could help that would be great. I want to avoid using delay(); if possible
@lyric echo use millis() and compare times, delay blocks the code from running anything while its delaying, comparing millis allows the code to do other things while waiting
yes I realized that, Ive tried to use millis() but I just cant get it right.
this is what i have
if(millis() > time + 1000)
{
count--;
lcd.setCursor(0,0);
lcd.print("WARNING " + String(count) + " ");
time = millis();
if(count == 0)//timer reaches 0
{
x = false;
delay(500);//allows you to see 0 for a little bit
alarmState = "distress";
}
else {
x = true;//unique for timer reset when moving from warning to idle state
}
}
see the "blink without delay" examples
for some reason its just counting really weirdly. The first time around it counts down. But the second time it seems to not enter that if
I'd use timerOne. You can have it execute a function after a specified interval. Best of all, it's non-blocking, so you can execute code while it's counting.
i dont think I can use timerOne, I am using tinkercad for testing with a virtual circuitand It wont let me add that library
and I need to use tinkercad as this is for one of my projects for school
i will try looking at blink without delay first
would somebody be able to show me? Sorry for asking for so much.
basically you update the current time, all the time, in your loop then compare what it was to what it is in the if
should I be updating in more then one spot
in my loop
if there is certain states i am in while in my main loop
no, just use one as the main timer, currentMillis, maybe have different previousMillis in each if
if(currentMillis - previousMillis > interval)
{
previousMillis = currentMillis;
I have this now it works well
previousMillis = currentMillis; ```
this updates the time, correct?
if interval is 1000 it's as accurate as the mcu's crystal, pretty close to 1 second
not sure what you mean, unsigned long currentMillis = millis(); in loop "sets the time"
you are welcome!
any idea on how I can get the sound using tone to be more clear with a piezo
i feel like sometimes its very rumbly or glitchy
mount the piezo firmly, and an enclosure has a huge effect, it isn't ever gonna be hi-fi
try slightly different tones as well
got it!
Hey, does anybody know what the pads on the back of the Lolin D32 Pro are for?
The two yellow/greenish pads top left and bottom right. Iโm making a metal case so Iโm not sure if itโs okay to make contact.
I guess they are grounds. If you really dont want them to touch metal, just put some tape over them.
They may also be for connecting a JTAG device for programming the chip -- also should not cotact the case.
I'll measure them later. Hopefully it's only ground. But plastic washers might be a good idea anyway
This is the concept by the way
They look like "fiducial" marks, which are added so component pick and place machines can know where the board actually is on the machine bed. If so, they are not connected to anything.
JTAG pads would be grouped together
Probably right, but I would still not connect them to the case...perhaps just a bit of kapton tape over them.
Thanks for the tips ๐ If I can get a functional prototype in the workshop, I'll share it here.
hello guys !
what do u think of the max30205mat body temperature sensor
is it good ?
i need it for my project
so many people says that arduino controlled relays are not reliable and can cause fire in full time work is that true
There are two ways a relay could cause a fire: the coil side, and the contact side. It could be that some poorly designed relay boards are overloading the coil side, but the usual failure mode is the coil overheats and either open circuits (safely stops working) or short circuits and blows a fuse. However, if there isn't circuit protection, the coil could get hot enough to start a fire.
The contact side can cause an issue if the relay isn't appropriate to the load (some cheap relays might have inaccurate ratings).
They are mechanical devices, so can wear out over time, especially if they're operated on a frequent basis or are cheaper units.
thanks for the help
If possible transistors are more reliable in that sense because they less likely to be falsely rated (usually fets choosen)
My osc probe is causing strange behavior in my circuit, or rather the act of me probing my problem circuit fixes it
i get strange flickering on my APA106 leds when theyre connected to a level shifter unless my probe is attached
Uhm I also seen this in some tutorials (doesn't make sense imo) adding resistor in series to data in line @jolly kayak
Also maybe decoupling caps?
i removed the resistor, same behavior, works great when probed. where should i add the decoupling caps? on the level shifter?
also i forgot to ad in my schematic but there is a 1000uF cap on my main powerline
adding a 100nF decoupling cap to the level shifter vcc pin did nothing
@distant plinth I haven't used the MAX30205 myself, but Maxim is a well-known company, and the chip looks like it's got good performance and a relatively simple interface. I don't know your particular project, but this seems a reasonable choice if you need a consumer-medical sort of temperature sensor.
that is exactly what i need, the project will measure the person's temperature with no contact
i guess its does an excellent job doing this function
@jolly kayak You may want to connect all the inputs on your level shifter to something. Floating inputs can cause all sorts of issues.
@distant plinth The chip is a contact temperature sensor, though... it just measures the temperature of the chip itself.
what..
it doesnt measure the temperature of things infront of it ?
that what i found online
@jolly kayak I was thinking decoupling cap to the signal line
decoupling the signal line created other odd behavior
Yeah, that's no surprise really
@distant plinth Unfortunately you need a different one if you want an IR measurement from a distance, yeah. For example, https://www.melexis.com/en/product/MLX90632/Miniature-SMD-Infrared-Thermometer-IC
ill try what madbodger said
@cedar mountain it doesnt measure the distance of people infront of it. that what somebody told me
that one is great too buy it is too expensive for me
i cant buy online
i didnt find it locally v
@cedar mountain where did u found that the max30205mat sensor measures the temperature of the chip ?
what is the article or data sheet
Here's the datasheet: https://datasheets.maximintegrated.com/en/ds/MAX30205.pdf
@north stream i tied all the inputs of the level shifter to something but the behavior is the same
@cedar mountain im so sorry, but where is the sentence that proves that this sensor measures its temperature instead of other people's
im new to electronics , sorry.........
Hmm, the "level shifter makes the LEDs go crazy" and "strange flickering unless a probe is attached" both point to data/grounding issues.
@distant plinth It's more the other way around. Unless a chip specifically says "infrared" or "remote sensing" or something, the default for a temperature sensor is that it just measures the temperature locally. For a remote sensor, you'd expect to see extra specifications like measurement distance, field of view, etc. and see an optical window on the top of the chip which it's using to view the outside world.
@north stream what should i look for?
and how might i go about fixing that?
ive checked all my wires, grounded it from a good powersupply, made sure all grounds are tied together
@cedar mountain i didnt understand u quite much. in conclusion does this sensor measures the temperature of other people infront of it
@jolly kayak It's something we're both missing. I can only guess.
i just went through my breadboard with a continuity tester and confirmed the grounds are all linked together
Maybe check your ESP board to see if all its grounds are connected together?
just did, since its plugged into my breadboard as well
@distant plinth It's just a local temperature sensor, as far as I can tell. So it'll measure its own chip temperature. Probably it's designed to have good thermal contact through the copper pad on its underside, so it can measure the circuit board, etc.
hmm
but it s named max30205mat BODY TEMPERATURE SENSOR
@cedar mountain
i dont think that is a mistake my maxim
Yes, it's optimized for especially good accuracy around 98F. So you could use it to build a thermometer, like the ones you stick in your mouth.
but, can it measures people's temperatures with no contact ?
No, it can't.
ok thanks a lot ๐
so the only sensor that measures temperatures with no contact is probably the mlx ?
There are others out there, but they're definitely a more specialized product. Also do bear in mind that they will just give you skin temperature, not body temperature, so it won't be the usual 98.6F reading.
@north stream im not sure where but you were right, it must have been a ground problem. As an act of desperation i rebuilt the circuit on the breadboard, and it works with no probe now haha
@cedar mountain bro sorry for asking too many question, if i want a sensor for my project that measures the body temperature with no contact to see if somone is in danger or not, what sensor should i get ?
i would imagine some sort of infrared sensor
It's not a completely obvious measurement to make... there's a reason that doctors generally measure temperature with an oral thermometer. If someone has been out in the sun, their skin will be warm and show up as a fever, etc. But yes, as @jolly kayak says, you need an infrared sensor.
probably something like this
ok what about this @jolly kayak : https://datasheets.maximintegrated.com/en/ds/MAX30205.pdf
i think the mlx is better
just a quick disclaimer, ive never worked with these types of sensors before but that doesnt look like an infrared one
so with those types of sensors youll have a piece of metal or something directly touching the chip so it can read the temperature
youre looking for specifically an infrared temp sensor if you want to take temperatures at a distance
alright, i see i need the mlx one. i will see how can i get one. Anyways thanks a lot @jolly kayak @cedar mountain for helping me for my project
How do I declare an array of char[]'s??
Depending on how you plan to allocate them, you can use char * strings[SIZE]; or char strings[NSTRINGS][SIZE];
I have 43 strings that are similar to
'EST-10EDT-11,M10.5.0/02:00:00,M3.5.0/03:00:00'
I want to assign them all to an array so I can then use the array index as the pointer into the array to set an external variable
Ah, you want to allocate and initialize a bunch of strings.
Basically you can do that with something like ```c
char strings[43][48] = {
"EST-10EDT-11,M10.5.0/02:00:00,M3.5.0/03:00:00",
"EST-10EDT-11,M10.5.0/03:00:00,M3.5.0/03:00:00",
"EST-10EDT-11,M10.5.0/04:00:00,M3.5.0/03:00:00"
};
In Arduino, you'll probably want to set the type and storage to PROGMEM so they don't eat up all your RAM
I'm not 100% clear on the syntax to do so, however
What
So I've got a Wemos D1 Esp-Wroom-02 I'm trying to develop for
but I keep getting this error:
and my code is https://pastebin.com/zb7Fubdz
It does run on it but only flashes the green and blue led but doesn't do anything with my screen
That doesn't look like a compile error, just statistics about your compiled binary.
Then why is it happening when it wasn't before?
https://pastebin.com/3mpXhyq6
@somber gazelle that seems completely fine, all esp units showed similar thing to me (8266 and 32 wroom 01 [what do we call old version now?])
it doesn't happen for Arduino products because arduino compiler be like that
Hmm
So if its not that why isn't it working
Sorry for the really vague question I honestly have no idea where to start
I tried looking up what I thought was an error which turned out to not be ๐
hmm
How would I know if my arduinos just resetting?
AHAH
I programmed something of my own and its working ๐
so it was something with the ocde I was using
Can someone take a look at this code for me? the Serial.println(pressure_sensor.pressure); works fine and dislays the pressure - I'm just wanting it to store the mix and max pressure in variable maxReading and minReading, but it's just displaying 0 for the value. Any help appreciated: https://pastebin.com/vjMHiV0t
What sensor and library are you using?
Using the DLV sensor - 005D - it's working great and no issues there
the issue is trying to store the min/max values I'm getting from the sensor reading
So you're saying that if you add a Serial.println(pressure_sensor.pressure); into the exact sketch you pasted, not an example or another test sketch, it outputs a correct value?
that is correect
I just didn't paste the full code so wouldn't have extra information in there that wasn't germane to the problem
Well it would be nice to see the whole thing if you're giving out a pastebin
sure - one sec
Is it just the min value or both the min and max? Because minReading shouldnt work since you're initializing it as 0 unless your pressure is a negative value
Here it is: https://pastebin.com/B5eJe8PC
you're exactly right - it can go negative
it reads both positive and negative pressures
Okay, just so I'm on the exact same page could I have a pastebin of the serial output?
Aha, because you are storing a float in an int
aha! So change it to float on the init?
I would either change your unit of measurment or change both maxReading and minReading to floats yes
that did it!! thank you!!
Np! Glad to help
I hate it when I make stupid mistakes like that.... the nature of programming I suppose... at least it wasn't a missing ; hahah
Lol, certainly, we do it all the time too. You should get a rubber ducky for any future issues
I keep meaning to buy bulk rubber duckies
HAHAHA!
Hello, not sure if anyone can help me... For some reason, after saving and taking a break, the Arduino IDE no longer opens on my MacBook air running OS 10.14.6. The IDE never gets past the โInitializing packagesโฆโ it automatically closes and repeats after I try reopening the IDE. I have done everything I can think of as far as troubleshooting. I have deleted the software, re-downloaded, restarted my computer, try different versions of the IDE.
My other coding platforms work fine as well as all other programs on my computer.
You might get a hint by running it directly from Terminal and seeing what it prints. Try going to /Applications/Arduino.app/Contents/MacOS and running ./Arduino. Normally, it will print Set log4j store directory /Users/spam/Library/Arduino15 and start up normally. However, you may get more messages if something is awry.
Another thing you can try (also from that directory) is otool -L ./Arduino which should print out what libraries it's trying to use.
im sorry im a noob and dont quite know how to do that
No worries. Open up a Finder window and press โ-shift-U to open the Utilities folder. Then double-click on Terminal to run that.
It'll give you a text window where you can type Unix commands and anything they print will show up.
it says no such file or directory
Hmm, perhaps Arduino is installed in an unusual place for some reason.
the weird thing is, it worked and then suddenly decided to not open. no error messages or anything
That is weird.
the IDE is in my applications folder
Your own Applications folder, or the system Applications folder?
Well I'm super excited! I just pinched 6fps from my PyGamer by writing a 32bit memcpy function!
Hello
hey, can someone help me with a little problem i have on a little project
i have two buttons and three LED's, i want it so that when both buttons are open the RED LED is on, when one i closed and one is open the YELLOW LED is on and when both buttons are closed the GREEN LED is on, the problem is that when i push one button the RED and YELLOW light turns on only 50% and when i push both buttons the GREEN and YELLOW LED is on about 50%, but the RED LED turns off as it should
Hello, anyone have any experience with uploading code to esp-01s via arduino? I just can't make them talk to each other
@flint quarry Sounds like you have code that tests the switches individually so it's changing back and forth really rapidly
ah, sounds likely, do you know how to fix it, delay maybe?
I'm thinking of separating the reading of the switches and the logic, and using Boolean logic. Something like ```arduino
int button1, button2, red, yellow, green;
button1 = digitalRead(BUTTON1_PIN);
button2 = digitalRead(BUTTON2_PIN);
red = yellow = green = LOW;
if (button1 && button2) {
// both not pressed
red = HIGH;
} else if (button1 || button2) {
// one not pressed
yellow = HIGH;
} else {
// both pressed
green = HIGH;
}
digitalWrite(RED_LED_PIN, red);
digitalWrite(YELLOW_LED_PIN, yellow);
digitalWrite(GREEN_LED_PIN, green);
@north stream thank you, it works perfectly now
https://hastebin.com/woxoqocitu.cpp
i need a way to be able to use multiple instances off my class and set different pins to each new instances
i found this link https://www.reddit.com/r/FastLED/comments/cn7ctr/problems_with_creating_strips_with_fastled/ew866e6?utm_source=share&utm_medium=web2x (Template Metaprogramming) but i have NEVER touched that befor and im very unsure how to do this! help would be awsome!
It's a fancy word that basically means using templates to move values to compile-time processing. People make a bigger deal out of it than they ought.
In your case, I think you can just make a template class parameter called PIN or whatever, and use that in the FastLED template parameter.
Or is there more than replacing your #define LED_PIN ?
template <uint8_t DataPin> class MYFASTLED { ...
Then replace LED_PIN later on with DataPin. When you create an instance, provide the template parameter 22 for the one using data pin 22, for MYFASTLED<22>(), and use a different pin number elsewhere.
Or template<uint8_t DataPin, uint16_t NumLeds> if you want that.
exit status 1
invalid use of template-name 'MYFASTLED' without an argument list
and it highlights this
MYFASTLED *STRIP1;
It needs the <##> after it.
MYFASTLED<22> or whatever.
If it's inside the class, use the variable name.
MYFASTLED<DataPin, NumLeds>
it's outside
if you look at the code you see i call
MYFASTLED *STRIP1;
at the very bottom after i close the class
Effectively all you're doing is replacing the #define with a different compile time constant encoded in the name of the class. So anywhere you used to have MYFASTLED now needs the constant MYFASTLED<TheConstant>
If you used constants 22 and 23, the compiler (extreme simplification) treats it as two different class names, one class called MYFASTLED<22> and another class called MYFASTLED<23>.
That means your plain old class MYFASTLED doesn't exist any more and anything that used to use it needs to use the new updated name which requires numbers inside angle brackets.
hmm
There's more going on under the hood, but it's harder to expain.
cause in my setup i use
STRIP1 = new MYFASTLED(22, 72);
There are rules allowing the compiler to automatically infer the values based on other context. If the compiler can figure it out following those rules you don't need to explicitly write it in the code.
I don't know your comfort level. Templates aren't a beginner friendly area of c++, usually people wait until they've got several years of real-world programming experience before they dig too deeply into them.
but i would need to be able to get and set variables on each strip individualy
that's why i want to run instances of the class so that each strip has it's on set of variables
I'd recommend a different approach overall, in that case. Your functions really don't have a need to know details of the light strip, what pin it is on, and similar. All it needs to know is that it is using a single strip. See https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples
The FastLED library for colored LED animation on Arduino. Please direct questions/requests for help to the FastLED Reddit community: http://fastled.io/r We'd like to use github "...
What is your experience level with C++?
more beginner then anything
i want a class with all the variables and then make instances of that class for each strip and be able to call them by
Strip1->getVariable();
Strip2->SetVariable(VarToSet);
Your code posting has vanished, and I don't have the time to dig deeper into it because it would take some effort, but from what I remember from the posting, it would probably be best to have your code just manipulate CRGB arrays without doing any FastLED processing, and keep the actual adding and drawing of them outside your library.
You don't need complex classes for accessors and mutators (commonly called getters and setters).
Just use an array and use the data directly.
There certainly are good reasons to protect them and provide data abstractions, but for small beginner-size programs those reasons usually don't apply.
There are great reasons for them on large projects with millions of lines of code.
The wrappers and abstractions usually cause more difficulty than they are worth with small programs, and they aren't exactly easy for the inexperienced to create.
So still have the classes if you want, but allow them to take a CRGB pointer. Keep the pointer around out in your main class or as global variables. I'm also assuming you've got enough memory for it on your board.
yea it shouldn't be a problem
For multiple strips, the FastLED authors have done some things shown in their last example in the Multiple Controller example, where you can access individual strips using an array notation:
FastLED[0].showLeds(gBrightness); // Strip 0
FastLED[1].showLeds(gBrightness); // Strip 1
FastLED[2].showLeds(gBrightness); // Strip 2
That approach might work better for you in some tasks.
You can also create an array of controller pointers, if you need that, as shown in their example. It may work better for other tasks.
But either way, it quickly leaves the realm of beginner programming.
hmmm
@mossy plume the thing is im using socket and i've made a program in python that talks to the ESP32 and controlls everything about the WS2812B strip! so i call it by
Strip1->SetPattern(1); // sets the current pattern to Solid Color
Strip1->SetColor(95, 255, 255);
Strip1->SetDelay(20);
and so on...
could that be done in that fashion with fastLED[0] method?
can anyone help me w/ smthing, i have to write code for a potentiometer circuit on the arduino red board but haven't done any coding since school went online (which was like 5 months ago)
Basically, you'd use analogRead() to read a voltage from one of the analog pins, which in turn would be hooked to the wiper of the potentiometer.
ight thank u
Hello, I was wondering if someonecould help me? I am trying to recreate this project
https://kfreitag.ca/laptopled/
https://github.com/KierBear11/LaptopAmbilight
But the Arduino code there is written for a ESP8266 . I was wondering if someone would be able to help me modify it to make it work with an Arduino UNO? or make a better version of it?
I followed this guide and my lights work, I just couldn't get that github code to work. https://randomnerdtutorials.com/guide-for-ws2812b-addressable-rgb-led-strip-with-arduino/
Got some extra LED lights from your fancy bedroom light strip kit? Well boy oh boy do I have the project for you! With a little bit of soldering and programming you too can make your very own laptop LED backlight to amp up your movie nights in bed, or just to make mindlessly b...
Laptop case LED strip ambilight. Contribute to KierBear11/LaptopAmbilight development by creating an account on GitHub.
Hello, looking for some help connecting a usb only thermal printer from arduino sending out ttl serial. Is this possible? Would this require a converter or just an adapter? I have not worked with USB before.
In general it's unfortunately going to require a computer or more powerful microcontroller board in the middle to act as the USB host. While you can get adapters that can convert TTL serial to become a USB serial port, you can't really go in the other direction to have a TTL serial port control an arbitrary USB device.
The Arduino Due has limited USB host functionality, but as far as I can tell it only supports keyboards and mice. Link: https://www.arduino.cc/en/Reference/USBHost
If you're interested in thermal printing, you can pick up a thermal printer from Adafruit. Their $40 one uses TTL-level UART, so you can use it with any ol' Arduino.
Open-source electronic prototyping platform enabling users to create interactive electronic objects.
Thanks, appreciate the help
@smoky sun if you willing to dig down on hardware good chunk of printers still use serial communication (ours used rs232 interface) probably can find the USB to serial converter in there if you interrupt that you should be able to send your own commands
Or you could buy rs232 printers too 2nd hand sell sites should have them (the one here does) some old shops trying to flip them for a little bit of money
@cyan jasper good idea! would be cool to see what's inside at the very least and it might be serial inside as you mention.
@jolly hearth ๐
it looks like this is the example sketch that is referring to a "feather nrf52":
https://github.com/jps2000/BNO080/blob/master/nrf52 feather_BNO080.ino
yes
i assumed it was a bluefruit as it includes a bluefruit library
actually in the code is says it is a adafruit
i think they are referring to this feather:
https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/device-pinout
there are numerous "nRF52" chips, and several Feathers based on those
in the case of that Feather, it's the nRF52832
but you have one of the newer nRF52840 based Feathers
the I2C pins SCL/SDA are common, so can just re-use those
for N_RST, just change to a free digital pin on your Feather
and change this line of code to match:
https://github.com/jps2000/BNO080/blob/dbd58bb6a422430845d1436e2390a823478d24c0/nrf52 feather_BNO080.ino#L59
ahhh that makes sense, thanks for that!
i think they are referring to this feather:
https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/device-pinout
@leaden walrus quick question. its saying to use a 4k resistonr for pullup on the NRST pin do you have any idea if this should go to ground or power?
it does work at this point but the reading dont seem correct yet..^
"up" implies "power"
i kinda figured that, still learnig.. thank you
but probably better to say "v logic" (or similar) instead of "power"
just in case they are different
i just connected it via bluetooth to the adafruit app and it acutally seems to work there on the plotter. so maybe not necessary
see here for some general info on pull up / down resistors:
https://learn.adafruit.com/circuit-playground-digital-input/floating-inputs
which might help with the basic idea of what they do
Hello, i'am french
bonjour!
i'm sorry "bonjour" is the limit of my French
Bonjour, je ne suis pas seul
En effet, Tu ne suis pas seul ๐
but no im not french
Ok; Super
just know some
I've been trying to interface with a 74HC738n for several months, but I'm blocking
the 74hc138 is used to write leds and read buttons in row and column
But I have a problem when I try to do both in my code
Just turn on the LEDs, no problem, just read the buttons, no problem, but both do anything
Sorry again for the translation
can you post a schematic and your code to pastebin or gist?
Thank you but it is commented in French
And here is my code:
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
byte arduinoMac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress arduinoIP(192, 168, 1, 165); // desired IP for Arduino
unsigned int arduinoPort = 8888; // port of Arduino
IPAddress receiverIP(192, 168, 1, 160); // IP of udp packets receiver
unsigned int receiverPort = 8080; // port to listen on my PC
EthernetUDP _Udp;
#define MAX_NUMBER_OF_LINES 8
uint8_t ledtouche1[MAX_NUMBER_OF_LINES]; // N lignes, un bit par ligne
uint8_t ports1[8] = {B00000000, B00000001, B00000010, B00000011, B00000100, B00000101, B00000110, B00000111};
bool lecture = false;
void setup() {
Ethernet.begin(arduinoMac, arduinoIP);
_Udp.begin(arduinoPort);
// put your setup code here, to run once:
DDRC = B01110111; // Code binaire des colonnes TMP IC11 -- adressage led et boutons
DDRA = B11111111; // Ecriture des leds -- premier TMP
DDRF = B00000000;
pinMode(41, OUTPUT); // -- premier TMP
ledtouche1[0] = 1;
ledtouche1[4] = 1;
Serial.begin(9600); // open the serial port at 9600 bps:
}
void loop() {
for (int i = 0; i < 8; i++) {
if (ledtouche1[i] > 0) {
digitalWrite(41, LOW);
PORTC = ports1[i];
delayMicroseconds(20);
PORTA = ledtouche1[i];
//Vรฉrouiller les leds
digitalWrite(41, HIGH);
delayMicroseconds(200);
}
delayMicroseconds(20);
for (int j = 0; j < 8; j++) {
if (bitRead(PINF, j) == 0) {
envoiUDPServer(1, i, j);
}
}
}
}
void envoiUDPServer(int tmp, int col, int ligne) {
_Udp.beginPacket(receiverIP, receiverPort); //start udp packet
_Udp.print(tmp);
_Udp.print(col);
_Udp.print(ligne);
_Udp.endPacket();
}```
apart from the topic, why do you read buttons with jk flip flops? (thats interesting and you might know something i don't)
We are working on already existing electronic cards
ahhh alright
Google translate:
Cela semble intรฉressant, je suis au travail maintenant mais je peux l'รฉtudier plus tard.
I guess i'll reseach that today ๐
This is a very important project and the people who help us will be highlighted on our publication.
It is also part of an open source project
Here is another code approach, but the LEDs are very weak :
test :
@reef ravine @cyan jasper google traduction: thanks for your help
@hollow imp
Vous รชtes les bienvenus, il faudra plusieurs heures, je suis prรจs de New York.
I usually remove all (non-relevant, extraneous, or unused) code and harware (if not too difficult; and some hardware can be left connected but ignored) to simplify things.
With experience, it becomes possible to do that in your head. ;)
So, the complete code is also useful when sharing the problem with a stranger, but so is the reduction of the code.
Photographs of the implementation can shine a light on things, as well.
does external interrupts on atmega328 effect timer interrupt I want to both catch the IR receiver data and send out data with 38kHz IR LED
and possibly use 4 more PWMs with timer 0 and timer 2
There might be a hierarchy of interrupt priorities, and there's often a non-maskable interrupt feature of some sort (indicative of a converse, masked functionality).
masks may well mean parallel priority (the masking -- not some hierarchy -- decides).
Just guessing. Been a very long time since I've worked on the problem honestly (with real thought behind it, and research).
I'm aware of the hierarchy but im not sure if external interrupt "uses" timer in a way that a PWM uses not sure if both could act at the same time
i guess one way to find out
asking mainly because i cant find any library that clearly states how its implemented and/or not bloated with protocols
@pine bramble your message is related to my project?
Yes.
Handheld cpu here in discord, so very terse.
PWM and timers strike me as autonomous peripherals, built attached to the core.
You'd expect them to .. run with little dependence.
Even GPIO is essentially a 'clocked' event
(desktop now) Bear in mind that there'll be registers associated with funk. ;)
So grab that cup of coffee an hour after a night's sleep, and really see the datasheet (grasshopper).
Even GPIO is essentially a 'clocked' event
Yeah like STM32F405 is a good example - you have to setup the clock for GPIO itself.
(in machine language programming of the chip without some higher level programming environment that does this for you)
That really smart guy in the arduino server mentioned this (that gpio is clocked). I think it was him (?)
i tried different ways and tests. you think my code is approaching proper functioning?
(in response to my saying what is this madness, gpio clocked? type comment from me)
dpclive I couldn't quite understand your code and hardware as presented, but I didn't look too carefully.
You can remove all sleep/wait/delay statements and find a different means to do equivalent timing delays.
(I think arduino people keep saying millis(); there)
Essentially, the main loop is almost empty (If I remember this). Instead, set boolean flags when things happen. Act on them asynchronously (well after they happen, but still timely to a human sense of timing).
The basic idea is sometimes called a State Machine.
You can get a very good feel for these ideas by working exclusively with the USART (serial port).
my problem is mainly on the management of common addressing between the reading of the buttons and the writing of the leds
Diodes come to mind immediately, but you have existing hardware that for some reason isn't to be modified, so the designer had a specific idea in mind to interface to that hardware.
the problem with serial port is that they delay treatment
I'm just saying you can learn a lot from using the serial port effectively, without investing in hardware building. It's already present (USART is already present).
if you arent multiplexing LEDs a LED update function can help
yes, it is a large remote control with buttons and leds
if you dont have change in LEDs you just pass the LED section of the loop and pass to the buttons
or if you dont have any LED change action you can continuously poll the inputs
Seems to me Steven K Roberts at microship.com used some kind of latches for his keyboard (16 bit binary input array of toggle switches).
What the exact hardware is, and does, and was designed to do, all factor in.
maybe you can use timer interrupt to refresh LEDs 30 frames per second
I would make a list of all chips and be able to describe what they do.
I'm planning on scanning a bay of pushbuttons, and measuring the events for duration, then latching that data. Essentially debouncing.
The output will be flat GPIO that holds its state (forever) in an 8-bit parallel bus that talks to another MCU. ;)
I'll probably use Grand Central M4 to do the scanning. ;) (what a waste)
And the STM32F405 will be the receiver of all this goodness.
I'm sorry but you really lost me
That'll be my fault. ;)
I'm explaining (briefly) a similar project with similar goals.
And how I'm approaching it.
I thought that working with a multiplexer would be simpler than that
Which part number is that?
Nobody here is necessarily anything but a student or novice, by the way.
Start with that assumption (that people found here are more apt to be peers than experts).
IC 13 sur le shcรฉma (74hc138n
Yeah the 74HC138 is the important part of the part number. ;)
That's a 3 to 8 decoder.
So always say "I have an 74HC138N, 3 to 8 decoder chip in my circuit, and I ..." then talk about the issue.
Yes, I can write the LEDs and read the LEDs individually
This way it triggers the human memory of what that chip is and does.
Lun 74hc138n is used to manage columns (8) for writing leds and reading buttons
What's the complete circuit on the output side of the 3:8 decoder?
Then I have 8 bits on each side of this component for reading the line of buttons and writing the line of LEDs
I will make you a drawing
Reading and writing on the same physical wires may be a challenge. ;)
'tri-state' comes to mind.
Some pins on a CMOS device are brought to a hi-Z state, essentially removing them from the active circuit.
(high impedance)
be back in a few minutes.
I am sorry for the quality of my drawing, I hope I have been clear enough
Yeah if that bus is shared the 74hct138n may need its output tri-stated to succeed on a read op.
(to unload the bus)
/E1 and /E2 I'd think.
How should I do it?
Not sure, probably a GPIO pin to control one or both of them.
That 3:8 looks like only one of eight outputs is selected at a time.
Outputs are active LOW.
So this chip 'completes the ground circuit'.
You can use an array of Darlington transistors to drive the other end.
do we have to add components?
Still trying to figure out what you already have. ;)
No, I'm not saying add components. I'm saying if you designed from scratch, and were committed to using 74HCT138N you might very well have decided to drive the other end with a darlington array.
It is an already existing card
The graphic you reproduced was scaled pretty low in resolution.
I will make it bigger
That would be very useful. ;)
Much better.
IC12 74HC244N
RB5 10k x 8
Looks like RB5 are 10k pullups on the 244N outputs.
Most of those chips look like buffers by glancing at the part numbers.
If you don't press a button everything is at 5v
I would never have guessed RB5 from the earlier rendered schematic so that was helpful.
It's probably a potted part with 8 leads plus a lead for Vcc to connect to.
(potted is like glazed ceramic like a capacitor)
I understand, in any case thank you for looking into my problem
yes
reading the buttons works very well and writing the LEDs with color management too
Pins 5 and 4 on the 74HC138 of IC13 are tied to ground.
Yes
So IC13 isn't 'modulated' .. it is hardwire enabled, 24/7/365, as it were.
It passes through whatever is connected to its three input pins.
I do not know if this can help, but before wiring the arduino, it was a TMP82c79p
What is that, basically? Any ideas?
Like that? Sorry my translation is not terrible
IC13 (outputs) are on a 3-device bus consisting of IC13, IC14 (74HC244N) and IC15 (74HC240N).
IC15 is used to lock the LEDs
Looks like inverting vs non-inverting explains the various part numbers of those line drivers.
The schematic as drawn is quite good. ;)
So one may believe the tiny drawings inside the boundary of each chip device.
Here is my code to turn on the leds:
for (int i = 0; i < 8; i++) {
digitalWrite(41, LOW);
PORTC = ports1[i];
delayMicroseconds(20);
PORTA = ledtouche1[i];
//Vรฉrouiller les leds
digitalWrite(41, HIGH);
delayMicroseconds(200);
}
The code doesn't really matter if I don't understand the schematic. ;)
Looks like R0 thru R7 near IC12 are data acquisition, from the point of view of the Arduino.
Yes
Very simply what is read from them?
If in 74hc138n there are 000 and I press the first button, I would have this:
1|1|1|1|1|1|1|0
If I press the second button, I would have this
1|1|1|1|1|1|0|1
Okay so it's passing data from 74HC138N.
no
The data of 74hc138n is used to select the column and R0 to R7 the lines
output 74hc138n :
A complete schematic would be far more useful here.
Same good resolution as that last segment.
000 : colums 1
001 : colums 2
010 : colums 3
...
R0 = ligne 1
R1 : ligne 2
...
I'm still very unclear on columns and lines as I don't yet understand the context.
It is a matrix of leds and buttons, I send you the rest of the diagram
The first picture is the rest of the diagram already sent and the second picture is the buttons and LEDs
That'll be helpful.
Okay most or all the buttons have a diode in series with a pushbutton switch.
The anodes of those diodes share a bus.
(common-anode)
I know less than you
The associated LED with each pushbutton appears to be two LEDs (probably one in red, one in green) back to back.
The anode of one is bonded to the cathode of the other.
Every other switch (S11 S12 S13) shows the LED's associated with the switch reverse-polarity.
This happens only rarely, however. I happened to spot the exception. Most of the matrix does not follow this exception.
Exceptional enough to believe the drawing is wrong (they got bored when drawing this many identical modules and inverted in their mind as they drew the exceptions). ;)
lol
So this reduces to a module that is both a pair of LED's and a pushbutton switch, with exactly 5 connections:
B C 5 6 7.
No, it is high-end equipment which is more than 20 years old
B and C are the pb switch terms and the other three are for the LED's.
We have all the technical diagrams which are very rare and sought after
as far as I can tell the LED's do not interact with the PB switches in any way at all.
It's very nicely done - I can see its value to you. ;)
I mean the two LED's are electrically independent of the associated pushbutton switch, per module.
Pushing a button has no effect, electrically, on the nearby LED.
Just ruling out possible interactions.
So, upper left of the LED/Pushbutton Matrix:
Rows 1, 2, 3 and 4 connect to terminal C of those pushbuttons in Column 1.
They are broken out at Pin 33 Pin 35 Pin 37 and Pin 39 (A-SSW 0 through A-SSW 3)
yes
These are going to be inputs to the Arduino (somewhere down the road).
A-SSW 0 traces to pin 9, just to the upper left of IC16
5 18 16 3 7 12 14 9 << that pin 9 ;)
Which seems to be IC14 in another drawing.
Now by the direction of logic of IC14 I suggest that IC14 is providing signal TO the pushbutton array.
It's sourcing, not sinking.
ASSW-0 to ASSW-3 goes through 74hc138n
Yeah so ultimately it gets its drive off the 3:8 input system S0 S1 S2.
So if you're going to bother to energize a pushbutton selectively like that, you're also going to want to read from that button on the 'other side' of it (its terminal, B).
The 3:8 decoder makes sure only one button row (or is it column, I'm confused) is active at a time.
IC13 has that job - to make sure we're only trying to read one row~~/column~~ of buttons at a time in that sector of the pushbutton matrix.
It all depends on how we look at the diagram, I'm talking more about the column at the operating level but on the diagram it's the lines
They are rows. not columns. ;)
Ok
In your pushbutton matrix diagram.
Those small radius 1/4 circle paths on 90 degree bends.
Those are cable harnesses (parallel wires bundled together).
ok
They fan out once having turned that 90 degrees.
Okay
So rows 1, 2 3 and 4 are energized at terminals C (top of switch).
They are read by A-SW 0 thru A-SW 7.
So we have A-SSW 0 sourcing and A-SW 0 sinking (reading).
CN1 (upper left) shows pins 18 20 22 24 26 28 30 32 mapped to A-SW 0 thru 7.
Yes
CN1 appears to pass through (also) to CN4 in parallel.
So you might be reading from CN4 or from whatever CN1 is connected to, to gain pushbutton input (data).
CN4 is another matrix of buttons and LEDs
I'm guessing IC12 is where the buttons get read.
yes, IC12 is connected on the arduino
Not a guess anymore. Takes several iterations flashing back and forth between schematic imagery, for me to get it. ;)
So whatever I said provides the row to be read, I think IC12 only knows which button in the same column of any given row was pushed.
I'm right at the edge of understanding. This has to happen in my brain before I can type it in English. ;)
Gating an LED circuit on and off may have some interaction, suggested only by your report of the behavior exhibited by existing code.
I like France just fine. Took French in school a very long time ago. ;)
https://en.wikipedia.org/wiki/Le_Dรฉfenseur_du_Temps for example. ;)
Do you have any code suggestions to offer me so you can move forward? I love English, I plan to go to England with my wife next year, its allow me to progress a little
I'm not yet very clear on where the problem is.
My problem is to link to 74hc138n, when I activate a column to write an LED and I keep this column to see if a button is pressed
Definitely try clearing each data line before doing something new.
It may need an excursion to the opposite voltage (ground, or Vcc).
Just a guess, or intuition.
S0, S1, S2 must keep the same value
I would reset them. Or set them, depending on the logic, but all three the same state (HIGH or LOW).
At each loop?
I think they were specified active-LOW so my guess (only a guess, intuition) is to set them all HIGH for a moment.
Yes each time you want something new to occur.
That may make things worse, or better, or at the minimum, change the exhibited behavior.
There are diodes associated with each pushbutton switch.
It changes the LEDs if I change the state of s0, s1, s2
If it locks but by line so I have to loop to turn on several LEDs at the same time
So I would ignore the LED's entirely, as first approximation, and get just the pushbutton reading working perfectly.
The buttons alone work perfectly
I'm not at all sure the LED's can function entirely independently in this context.
I'm trying to think of an application where non-independence of the LED's would be acceptable. ;)
It was intended as original
Try running the loop much faster; the design may call for a very rapid scan which gives a convincing illusion the LED's are constantly on, when in fact they are being switched on and off 300 times each second, in a pattern.
I'm going to show you my independent code that works perfectly
In this case you need to employ 'video blanking' to get the correct human-visual response.
So if you operate it very slowly it'll look different to a human. ;)
To read the buttons we do this
No we are going fast
for (int i = 0; i < 8; i++) {
PORTC = B00000000;
delayMicroseconds(20);
for (int j = 0; j < 8; j++) {
if (bitRead(PINF, j) == 0) {
envoiUDPServer(1, i, j);
}
}
}
I get the row and the column of the button pressed
what's envoi in english?
send
Nice. ;)
We use the same word as a synonym for 'ambassador' and it is a person, a diplomat, I think.
PORTC = input 74hc138n
('someone sent' ;)
Yes
I would PORTC = B00000000; // 3:8 decoder, energize PB array
Right.
Yes
For me I have to understand the circuit itself, electrically, before I think about code. Code is the very last step for me. ;)
I grew up with only hardware; software came much much later for me in my training.
and to write the leds, we do like this: ```
for (int i = 0; i < 8; i++) {
if (ledtouche1[i] > 0) {
digitalWrite(41, LOW);
PORTC = ports1[i];
delayMicroseconds(20);
PORTA = ledtouche1[i];
//Vรฉrouiller les leds
digitalWrite(41, HIGH);
delayMicroseconds(200);
}
}```
Ah okay, I understand
what does bringing 41 low do?
It is to lock and unlock the leds
74HCT240N IC15 input on pins 1, 19 signal name is /BD I think that may be pin 41 there.
Pin 19 is 2/OE (output enable input, active low)
So it's gating the line driver on or off.
So am I good?
I have no idea. ;)
The answers to these questions, when it's my project, occur to me while sitting outdoors on my front porch, watching pedestrians and traffic go by, and drinking coffee.
If I don't do that, the LEDs won't get blocked
'blocked' is confusing to me.
I've been doing it for days and days
My ignorance is to your benefit, really. You can see where I had to assemble in my mind what was going on.
assets if you prefer
;)
If it's of any help, this doesn't sound irregular, poorly-designed or difficult to achieve the correct outcome.
Kind of like a Rubic's Cube, and you're about 4 turns away from the answer. ;)
Yes, I see, but it's not in programming that it's wrong
I also think but it's very frustrating not to find
Well, try solving only the output problem (the LED's) and ignore the pushbutton array, entirely.
Pushbutton acquisition involves hysteresis.
When I do everything works for LEDs
(memory, a history of past events)
This is 'debouncing'.
Time is a very real factor in acquiring input.
Multiplexing input and output may bring issues with reliable input.
(keyboard debouncing may be in conflict with keeping the LED array in the desired state).
You might try making one or the other slightly more reliable.
Reading the buttons only and writing the LEDs only, everything works correctly, but the 2 is the mess, loss of brightness or lighting of the LED corresponding to the reading address of the button
Then see what falls apart (what no longer works well at all).
Yeah there may be an exclusivity . the specific ONE LED you want to light, you cannot .. but any other: yes.
This is why 300 times a second gives the illusion no rules have been broken.
Everything is deterministic at all instances in time; at each moment every rule is strictly obeyed; yet at 300 times a second, the human becomes convinced an unbreakable rule has just been broken! (a button, when pressed, also has its corresponding LED lit, even though this breaks a cardinal rule: no LED may be lit when its corresponding button is pressed).
I'm just ranting, but I think you may understand the intent.
Illusion vs reality: 300 times each second, things happen fast.
This is the case, the LED does not light up when the button is pressed
The ghosting and faint LEDs points to video blanking (turn off ALL LEDs every time!)
That may be your only problem, by the way. You cannot ignore video blanking, due to human vision (persistence of vision) physiology/neurology.
Suddenly, I'm a little lost. I'm blocking, but I'm sure it's not very complicated, I'm thinking of a time problem, but I did a lot of testing
The LED's can be lit one at a time.
It's possible to have just one of them lit, but no others.
I'm not even clear if it's possible to light more than one at a time.
3:8 decoding suggests only one LED column/row is energized at any given instant.
We can turn on several leds without loop only if they are in the same line
Okay.
So that part matches a project I did (also with a 3:8 decoder).
So you have 8 bits to work with, for (say) a 64 bit array.
You would light up to 8 LED's in a single colun/row during one instant in time.
During the next instant, you are to turn all 8 of them off.
So that then entire array of 64 LEDs is dark for a moment.
there are 8 bits for the lines and 8 bits for the 3 to 8 for the columns
Then and only then, energize the next single column/row, in some other bit pattern.
But the blanking when nothing is lit, at all, is mandatory.
That's what I do
Otherwise, ghosting in the human perception.
That's just how our eyes and brain work, in the context of flickering lights.
How many times a second does the array show the complete data on the LED's?
yes
When I code for POV stuff I run it slow so that I can see each step, then speed it up to get the 'video' effect (including video blanking).
This is primitive video. ;)
about 1millis6
You could slow that down a little but it should be uniformly bright for the entire array.
I would try different data patterns written to the LED array to spot a pattern of weakly-lit LED's.
After the leds are not identical and weaker
Different colors are often of different brightness (subjectively) but same colors usually are similar in brightness.
Presume all of a given color were from the same batch, that was a lot of soldering to construct the array.
What were the two colors?
There is one color per button either red or yellow
Okay. I'm not sure then why two LEDs per button position.
It's near 19:00 here so I have to leave. ;)
me, it's 1:00, I'm going to go too. Thank you for your time and advice, I hope I got my error. You seem to have understood the diagrams and in addition with a Frenchman trying to speak English
If you find arduino level solutions, I am interested ๐
I'm sure plenty will read this and one may know something obvious to them but not to us!
Nice to meet you.
The pleasure is shared
"A primate put this together. A primate can take it apart." .. my friend, to himself, dismantling an automobile engine down to individual parts. ;)
Indeed, each person sees things differently
Wishing you a pleasant evening, I'm going to sleep
๐ฉ๏ธ ๐ฉ๏ธ
does anyone know if i can use timer 1 input capture interrupt and servo library?
Hi, idk where to look but I wanted to check with someone about the wiring for ultra skinny neopixels. Is Black = Ground, Red = Power, Green = Data?
The website is misleading:
Now we have some Honey I Shrunk the LED Strips in the store. At an astonishing 4mm width these are wee yet surprisingly flexible and can fit just about anywhere. The wires are even nicely color-coded: black for ground, green for data signal, and red for 3-5VDC power.
The power/ground pads are on the top, the signal pad on the bottom.
The web listing is incorrect to the pictured image.
Do the <@&327289013561982976> have any idea? (Sorry if I shouldn't ping for this, I'm newer to the server)
@verbal path Community Moderators are for, well, moderation issues. so please try to keep pings to that. Feel free to poke the Community Helpers for those sorts of questions. Alternately, for questions regarding the web site, you can e-mail support@adafruit.com
Ok, the #code-of-conduct was ambiguous
On the Adafruit Discord, you may send an open message from any channel to all Community Helpers by tagging
@community moderators.
<@&617066238840930324> When you guys have time, could you weigh in?
I'm looking at the page right now, and it looks like they've connected it by color - Black to GND, Red to 5V, green to data. It looks like the signal is not on the bottom.
I'd recommend e-mailing support@adafruit.com because they can get clarification of things from employees
@tough snow sorry to bother, but I peeled away some of the backing & saw that red was attached to + & black was attached to - on the front. Which one should go where?
I'm not 100% sure, I haven't ever had them in my possession
That's fine. i reached out to support already ๐
@verbal path in my experience with addressable strips red is 5v, black is gnd, and green is data
Thanks @timid sail that's what I'm leaning towards!
np
Hi all. I have problem with arduino and i2c. I send value from DHT11 from slave (in slaves monitor i see 24) to master. I redefine float to uint8_t and send to master. But in master in monitor i see 255. Please help me.
are you scaling the value or just trying to pass it in?
are you scaling the value or just trying to pass it in?
@timid sail sorry, i dont understand, how its scalling? and why?
when you check the value using the monitor are you seeing just 24 or 24.00?
when you check the value using the monitor are you seeing just 24 or 24.00?
@timid sail only 24. it is first value of float, value are after dot droping
afaik they normally return a value like xx.xx
if you try and just pass that into a an 8 bit integer it's going to be too large
I thought what if i send value from 0 to 255 (from DHT) i can use unit8_t only 8 bit, and unit8_t same as Byte
May be for this value i need send first byte low, and second byte high?
Hi, can I use D0 and D1 on my arduino to use a temperature sensor
or am I able to use one of the analog pins for two different things
You have an analog temp sensor? I dont know what you mean by the second sentance and in the first you didnt tell us what you're using
Also what board are you using @lyric echo
i am using arduino
basically I am using all the analog pins
and i am using 2-13 on the digital pins
what can I do to add more things
Which arduino? Arduino is a C framework. And you didnt answer my question on the temp sensor
Ah, then no. Sadly the UNO has only the pins marked as analog, analog. But you can use a ADC to increase the number of analog inputs you have
They are for the serial to program it, I wouldnt use it
I always recommend steering away from the uno, I know some people really dont like that idea but thats IMO
ok thanks
Uart connected to USB converter chip (can be used as io but frowned upon)
So you have a DIP switch with two switches? It depends, you can swap a&b but for the sake of explaining Ill say pull both a pins with resistors, and each pin will go into an input, then the b pins are connected to ground
is there a way to just make it power the circuit
the whole thing
and then shut it down when its switched off
Yeah, just connect power to a and thing to b
Or the other way around, it is just a switch
Watch out for current limits with DIP switches, though, as the contacts aren't rated for much.
Question, was looking at different gps gsm modules, need smallest i can find. Found interesting sim808, but hear it has accuracy issues and a lot instability, at least read that.
Any recommendation for good gsm and gps module smalleat it can be?
I know here it's an unpopular opinion but uBlox tends to be quite small in comparion
They look about half the size, if not a little less
Depending on the model
Can i use anolog pin for HC-05 module? Used it for L293D+ arduino.
If you're using software serial you can
@stuck coral why unpopular?
I seem to be at an impasse... I split my ino up into .ino with just things in the setup and loop and some #includes, and then split everything else into .cpp and .h files. I'm almost done doing the cleanup but my setup loop has
MIDI.begin(MIDI_CHANNEL_OMNI);
MIDIUSB.begin(MIDI_CHANNEL_OMNI);
and one of the cpp filed uses MIDI.commands, so it's giving me
'MIDI' was not declared in this scope
errors on compile and I can't seem to think my way out of it...
@hybrid fossil well origonally when hobbyist cell modules were becoming a thing, they were hard to use, and power hungry, and big, and had terrible support. One day Adafruit introduced the FONA and for a lot of people here it brought a lot of cool experiences, its just whenever I mention uBlox instead of the FONA there is always at least one person who jumps in and yells FONA from the rooftops so I get the feeling its an unoppular option. Though through time i think the FONA has kinda lost it's lead and nowadays just pick the right tool for the job
No technical reason
@proven mauve if you want some help, I would recommend linking some pastebins here so we can peek at your code
MIDI_ thisMidiUSB;
extern MIDI_ thisMidiUSB;
MIDI_ myMidiUSB;
// other
myMidiUSB = MidiUSB.begin; // whatever goes here is probably taken care of, for you, elsewhere.
thisMidiUSB = (MIDI_) myMidiUSB;
.. maybe.
That was how I was able to access flashROM (for writing) in a multiple file .CPP type program.
I'm guessing the technique might also apply to MIDI (or anything where you are using this kind of reference).
Question!
currently my setup is WIFI and SOCKET
ESP32 - Wifi - Socket Server
Python software - Wifi - Socket Client
i just came across PainlessMesh for arduino and saw a commparison between wifi and mesh network and i love the idea that the ESP32 and my software does not need to connect to wifi just talk between themselfs!
is it better and possible for me to run Mesh network and socket on ESP32 and my python software?
@pine bramble I tried adding extern MidiInterface MIDI but 'MidiInterface' does not name a type then tried extern class MIDI but a storage class can only be specified for objects and functions
I am using this library for a serial MIDI: https://github.com/FortySevenEffects/arduino_midi_library
and this one for a usb MIDI on the same device: https://github.com/lathoub/Arduino-USBMIDI
Right now the compiler is hung up on the serial one
You can't just copypasta this.
Yeah, I thought I pulled the right class name out =X I'm gonna have to look into it more, I haven't used extern that I remember
What I did was get everything working in a single file, correctly.
Then (and only then) did I solve the problems wrt splitting into smaller source files.
extern references something already created. ;)
yes yes, everything is working in a single 1400 line file. I split it up into modules and am linking it all together now using .cpp and .h files
My problem was very similar in that I couldn't write to the flashROM doing it simply; I had to make a reference to what I think of (perhaps incorrectly) as the 'file handle'.
So I used (File) in a way that reminds me of 'casting' to a different type. In this case, File is that type.
So my MIDI object is being created in the setup loop in the main ino, then another .cpp file uses that class in a function to send data out. The compiler is complaining the .cpp doesn't know what the MIDI is
Maybe you can link the complete code base; talking about code in the abstract has limited usefulness. ;)
I routinely solve and understand code I cannot explain, lacking the vocabulary and many concepts to do so. ;)
โค๏ธ I really appreciate the help, as always
My debugging is very much compiler-error message driven. ;)
lol, the compiler messages were working good, had to add a bunch of #includes all over the place to link properly, then I hit this
I got no problem with spaghetti code so long as you wrote it, it works, and you understood it long enough to get it to compile correctly.
Factoring the code and stripping old coments is useful for long-term documentation and code reuse.
Does tamaguino mean anything? I have a weird directory suggesting I worked on that.
Nevermind .. I see your name in that. Thought so. ;)
At the command line, I think you can generally
$ git add .
$ git comit
to get started.
You would have to at a minimum have previously
$ git init
in a directory.
lolol
Hello @pine bramble , I absolutely wanted to inform you that we have managed to do the right thing. Thank you for your analysis.
@hollow imp That's great! I hope our conversation at least ruled out a few dead end investigations. ;)(
("Hope is not a strategy.")
@pine bramble can I ask your github name so I can invite you to it?
๐
dah-di-dah-dit, dah-dah-dit-dah since 1974 ;)
lolol
I cheated on the tamaguino project and used .h for everything so I could control when it included it
trying to do this one more to standard
I worked Puerto Rico on 15 meters (in 1974) when the band was dead and didn't yet know why there were no other stations heard (from Connecticut).
is 15m the wavelength?
Basically I followed Nick Gammon's advice about multiple files a long time ago, and now all my projects get the same treatment.
15 meters is what .. 45 feet, so 21 MHz or so. y=468/f (in feet).
DId you get the invite?
Length of a half-wave dipole antenna:
$ dc -e '14 k 468 21 / f q'
22.28571428571428 (feet)
Didn't look - may not be logged in there yet.
sorry for the hassle. The plan is to make it open source once I get on my feet with it in a few months. There's a device tied to it that will be sortof an instrument + learning platform is the idea.
I have no idea where to look.
It may've emailed me though.
got it. was email driven.
I'll just flip it public for a few, I don't mean to run you through the wringer trying to help me lol
oh kk
We're not yet at wringer level of brain strain. ;)
wow git command line is making me login to clone your repo.
The .ino initiliazes MIDI.begin(MIDI_CHANNEL_OMNI); MIDIUSB.begin(MIDI_CHANNEL_OMNI); in the setup (){} and then inputOutput.cpp is what the compiler is being annoyed about
ha, like a little ssh session lol
New branch for any suggestions I make.
If you refresh you'll see it in the webbed interface.
Yeah branches are great.
git branch -avv is really helpful in tracking them.
I'm going to try to compile your prog. What's the target board?
leonardo
Using "MIDI Library" and "USB-MIDI" in the library installer
I think Wire and EEPROM are the only other two I'm using
Still working on basics.
I still don't have a clean compile. Too many variables.
I don't know which libs should be removed from my Arduino/libraries directory.
Is there a clean-compiling version using only the libs used for the current version, leaving no (currently-required) libs out?
There's little sense chasing compiler errors that are phantoms. ;)
lol, one sec
That on should compile clean using the same libraries
It's all that one .ino, no .cpps or anything
It didn't, so I may have an extra lib available it's referring to, or I may be missing one.
one sec, I think there might be a 3rd midi dependancy
okay, so "MIDI Library", "USB-MIDI", and "MIDIUSB"
with the standard "Arduino Leonardo" board selected
Arduino/libraries/USB-MIDI/src/USB-MIDI.h:26:10: fatal error: MIDIUSB.h: No such file or directory
#include <MIDIUSB.h>
You're half a step ahead of me now. ;) Let me check for all three.
breadboard compiles now.
the other one exits with
'MIDI' was not declared in this scope
that be the one
You have both:
71 MIDI.begin(MIDI_CHANNEL_OMNI);
72 MIDIUSB.begin(MIDI_CHANNEL_OMNI);
The answer I gave earlier may apply to both of these 'MIDI handles' as I'll call them.
they are different types of objects tho I think
but yes, both are going to have this error issue
I may be in the wrong directory entirely. ;)
so in the midiControl.cpp they're created
typedef USBMIDI_NAMESPACE::usbMidiTransport __umt;
typedef MIDI_NAMESPACE::MidiInterface<__umt> __ss;
__umt usbMIDI(0); // cableNr
__ss MIDIUSB((__umt&)usbMIDI); //names the object MIDIUSB
typedef Message<MIDI_NAMESPACE::DefaultSettings::SysExMaxSize> MidiMessage;``` for the MIDIUSB and ```
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI)``` for the MIDI one
then they're initilized in the setup loop, but they behave very similar after that
$ ag midi | wc -l
60
for the breadboard version. ;)(
lolol
So I spent a few hours working on the breadboard version and then started cleaning it up into these separate files
i've never used that typedef method before to create an object, it's copied from their example. I'm used to the serial one-liner
Yeah.
Well I'll stick to the breadboard version for the moment, as whatever is going on is in a single file.
454 if(MIDI.read()) {
That MIDI. part there ..
That's what my method addresses.
Making it visible outside the .CPP file it's found in, initially. (in this instance just a single .ino)
hm, I did something the bot didn't like
But yes! So when it's split up, MIDI.begin(MIDI_CHANNEL_OMNI); stays in the .ino, but inputOutputs.cpp uses MIDI.dostuff but it can't see the MIDI object that was created
But, I don't see a smart way to remove MIDI.begin(MIDI_CHANNEL_OMNI); from the ino's setup function, and I don't know a way to tell inputOutputs.cpp that MIDI exists somewhere else
in all of these cases, MIDI is a specific object... specifically the MIDI serial connection on the serial pins of the atmega
and once we solve this, the MIDIUSB object will start causing the same problem
timerHandler() isn't visible when I split out the files.
Is MIDI an object that's automatically instantiated by the header file, or is it explicitly instantiated in the .ino file?
explicitly instantiated in the .ino file, in setup()