#help-with-arduino

1 messages ยท Page 61 of 1

north stream
#
    angle_pitch_acc -= -.85;
    angle_roll_acc -= -7.14;
tidal peak
#

ah, I see, depends how tilted it is since my surface was not flat

north stream
#

Since the code is trying to use cross-axis values for correction, it seems like mismatches would tend to accumulate.

tidal peak
#

hhmmm, I'll try re setting those on a flat surface and do another comparison

north stream
#

Worth a try.

tidal peak
#

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

tidal peak
#

yeah, it's still drifting a lot ๐Ÿ˜ฆ

wind drift
#

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

wind drift
#

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

wind drift
#

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")

north stream
#

You might want file.close(); before break otherwise it will never get called.

elder hare
#

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....

distant plinth
#

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

north stream
#

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).

distant plinth
#

is that hard ? what do i need exactly ? which sensors ? is there any guides in the net ?

north stream
#

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.

distant plinth
#

can i do this with ardublock or mbloc k

north stream
#

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.

distant plinth
#

what is the most simple way to do this job

#

sensors code etc

#

is this job too much for an arduino uno ?

north stream
#

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".

dreamy nebula
#

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?

north stream
#

Should be fine, just route the input supply through the sensing side.

distant plinth
#

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 ๐Ÿ™‚

north stream
#

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.

distant plinth
#

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

woven mica
#

Automatic hand desinfection dispenser

stuck coral
#

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

distant plinth
#

@woven mica that is a pretty awesome idea ! but i did it before....

woven mica
#

What do you need it for?

#

You can do it again (if you do it for school now and didnt before)

distant plinth
#

i need it for an online competition bro

#

someone did the idea you said

#

it is a good idea but someone did it

cyan jasper
#

anyone know an IR library that just gives me raw bit data? without those sony panasonic stuff.

cyan jasper
#

(I just want to send and receive really short data, and want it to be fast because it needs to be responsive.)

jolly kayak
#

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);
}

cyan jasper
#

@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

jolly kayak
#

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

cyan jasper
#

maybe buffer messes with the timings (I am not sure)

jolly kayak
#

would a 2n7000 nchannel mostfet switch fast enough?

cyan jasper
#

would a 2n7000 nchannel mostfet switch fast enough?
probably good enough

jolly kayak
#

perfect, cus thats all ive got on hand haha. ill give that schematic a try, thanks!

north stream
#

The 74HC125 should work just fine if it's hooked up properly. The transistor with resistor load will be slower.

cyan jasper
#

@north stream any ideas why it might be then?

north stream
#

Power supply wrong? Ground wrong? Ground bounce? OE not enabled?

cyan jasper
#

would a 2n7000 nchannel mostfet switch fast enough?
worst case give the sacrificial pixel a try ๐Ÿ™‚

jolly kayak
#

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

jolly kayak
#

unfortunately not having any luck with the mosfet circuit either

north stream
#

I suspect your problem lies elsewhere.

jolly kayak
#

@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

north stream
#

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.

jolly kayak
#

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

north stream
#

You have a scope? Scope the data line and the ground line.

jolly kayak
#

wait, im seeing 5v from the dataline

#

does the esp8266 output5v i thought it was a 3.3v device

north stream
#

Yeah, something's wrong!

jolly kayak
#

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?

north stream
#

Hmm, that spike might be a clue. Maybe you're getting reflections on your data line?

jolly kayak
north stream
#

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

jolly kayak
#

not too long, a few inches. i just tried wiggling the ground around and changing where the probe is grounded and neither helped

weak walrus
#

Hm I donโ€™t have enough pins left to use this speaker right?

#

Woah swiz that looks really cool

jolly kayak
#

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

weak walrus
#

Oh the scope whoops :p

#

I didn't see the video haha

jolly kayak
#

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

weak walrus
#

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

#

sorry hardware anything is not my strong point so I don't know what to call it haha

jolly kayak
#

looks like a uart connector to me, im not sure what board youre using though

weak walrus
#

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?

stuck coral
#

Its a "ICSP" header to be compatible with older arduino UNO shileds. (Even though the M4 doesnt have ICSP its just used for SPI)

weak walrus
#

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

stuck coral
#

Yes

jolly kayak
#

thanks iot, im blind and was looking at the plug to the left

weak walrus
#

Oh cool- I thought you were referring to the thing on the left

stuck coral
#

Nope, thats looks like a SWD connector

weak walrus
#

Gotchya!

jolly kayak
#

im wrong again

stuck coral
#

What interface are you using for your speaker?

weak walrus
#

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

stuck coral
#

Are you going directly to an amp with an analog signal or using something like I2S?

weak walrus
#

I was thinking analog but if there is something better I am open to learning that

stuck coral
#

Well I find I2S to be better, you spend less CPU time on sound so your processor can do things like update the display

weak walrus
#

๐Ÿ˜ฎ That sounds like what I need then!

stuck coral
#

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

weak walrus
#

awesome! Ill grab this then

#

Thanks

stuck coral
#

Np

#

Note that all the other female pins on the sides have a use ๐Ÿ˜œ dont just have to use the imitation ICSP header

weak walrus
#

yeah I am more familiar with those than the ICSP stuff from the uno ๐Ÿคฃ

stuck coral
#

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)

cyan jasper
#

Is uno capable of I2S I heard it was too slow

stuck coral
#

Well luckily for him he's using a ATSAMD51 not a ATMEGA328 but you are correct

cyan jasper
#

ohh

#

metro boards I thought they were atmega328 clone

#

sorry

jolly kayak
#

no theyre apparently really fast

weak walrus
#

I started with the UNO for this

#

It was super slow

#

So I swapped over to the metro

cyan jasper
#

arm is p fast

stuck coral
#

Dont be sorry, in the picture you can see the M4 label which is the SAMD51

weak walrus
#

It has been amazing so far

stuck coral
#

Oh yeah, love them SAMD51s and SAMD21s

jolly kayak
#

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?

stuck coral
#

Is that supposed to be a singal to a strip? I see your one pulse but where is the data?

jolly kayak
#

i was just zooming in to make sure the voltages were right, let me get a pic on the rest of the signal

stuck coral
#

Okay

jolly kayak
#

hmm any tips on getting meaningful info from the scope? otherwise its just a bunch of near identical square waves like that

stuck coral
#

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?

jolly kayak
#

setting up a strand test now

stuck coral
#

fyi Im playing a game so if I take a sec feel free to @ me

jolly kayak
#

@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

stuck coral
#

Oh thats good to hear! Why are the pin assignments different? What chip are you using?

jolly kayak
#

im using an esp 8266, when i use fastled if i point to pin 2 i have to point to pin 14 in neopixel

stuck coral
#

Ah, got it. Idk about the ESP8266 but on the ESP32 it doesnt matter much which pin due to the muxing

lyric echo
#

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

reef ravine
#

@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

lyric echo
#

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
      }
    }
reef ravine
#

see the "blink without delay" examples

lyric echo
#

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

mighty vigil
#

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.

lyric echo
#

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.

reef ravine
#

basically you update the current time, all the time, in your loop then compare what it was to what it is in the if

lyric echo
#

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

reef ravine
#

no, just use one as the main timer, currentMillis, maybe have different previousMillis in each if

lyric echo
#
if(currentMillis - previousMillis > interval)
    {
        previousMillis = currentMillis;   
#

I have this now it works well

#
previousMillis = currentMillis;   ```
#

this updates the time, correct?

reef ravine
#

if interval is 1000 it's as accurate as the mcu's crystal, pretty close to 1 second

lyric echo
#

oh ok

#

so wont really make a difference

#

if I update in other spots

reef ravine
#

not sure what you mean, unsigned long currentMillis = millis(); in loop "sets the time"

lyric echo
#

ohhh

#

I understand now

#

nvm then

#

im good

#

thanks for your help! I appreciate it.

reef ravine
#

you are welcome!

lyric echo
#

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

reef ravine
#

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

lyric echo
#

got it!

hazy summit
#

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.

woven mica
#

I guess they are grounds. If you really dont want them to touch metal, just put some tape over them.

odd fjord
#

They may also be for connecting a JTAG device for programming the chip -- also should not cotact the case.

hazy summit
#

I'll measure them later. Hopefully it's only ground. But plastic washers might be a good idea anyway

obtuse spruce
#

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

odd fjord
#

Probably right, but I would still not connect them to the case...perhaps just a bit of kapton tape over them.

hazy summit
#

Thanks for the tips ๐Ÿ™‚ If I can get a functional prototype in the workshop, I'll share it here.

distant plinth
#

hello guys !

#

what do u think of the max30205mat body temperature sensor

#

is it good ?

#

i need it for my project

sullen delta
#

so many people says that arduino controlled relays are not reliable and can cause fire in full time work is that true

north stream
#

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.

sullen delta
#

thanks for the help

cyan jasper
#

If possible transistors are more reliable in that sense because they less likely to be falsely rated (usually fets choosen)

distant plinth
#

have u heard about it ?

#

if yes tell me if it is good or not

jolly kayak
#

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

cyan jasper
#

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?

jolly kayak
#

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

cedar mountain
#

@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.

distant plinth
#

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

north stream
#

@jolly kayak You may want to connect all the inputs on your level shifter to something. Floating inputs can cause all sorts of issues.

cedar mountain
#

@distant plinth The chip is a contact temperature sensor, though... it just measures the temperature of the chip itself.

distant plinth
#

what..

#

it doesnt measure the temperature of things infront of it ?

#

that what i found online

cyan jasper
#

@jolly kayak I was thinking decoupling cap to the signal line

jolly kayak
#

decoupling the signal line created other odd behavior

north stream
#

Yeah, that's no surprise really

cedar mountain
jolly kayak
#

ill try what madbodger said

distant plinth
#

@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

cedar mountain
jolly kayak
#

@north stream i tied all the inputs of the level shifter to something but the behavior is the same

distant plinth
#

@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.........

north stream
#

Hmm, the "level shifter makes the LEDs go crazy" and "strange flickering unless a probe is attached" both point to data/grounding issues.

cedar mountain
#

@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.

jolly kayak
#

@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

distant plinth
#

@cedar mountain i didnt understand u quite much. in conclusion does this sensor measures the temperature of other people infront of it

north stream
#

@jolly kayak It's something we're both missing. I can only guess.

jolly kayak
#

i just went through my breadboard with a continuity tester and confirmed the grounds are all linked together

north stream
#

Maybe check your ESP board to see if all its grounds are connected together?

jolly kayak
#

just did, since its plugged into my breadboard as well

cedar mountain
#

@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.

distant plinth
#

hmm

#

but it s named max30205mat BODY TEMPERATURE SENSOR

#

@cedar mountain

#

i dont think that is a mistake my maxim

cedar mountain
#

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.

distant plinth
#

but, can it measures people's temperatures with no contact ?

cedar mountain
#

No, it can't.

distant plinth
#

ok thanks a lot ๐Ÿ™‚

#

so the only sensor that measures temperatures with no contact is probably the mlx ?

cedar mountain
#

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.

jolly kayak
#

@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

distant plinth
#

@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 ?

jolly kayak
#

i would imagine some sort of infrared sensor

cedar mountain
#

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.

jolly kayak
#

probably something like this

distant plinth
#

i think the mlx is better

jolly kayak
#

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

distant plinth
#

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

safe halo
#

How do I declare an array of char[]'s??

north stream
#

Depending on how you plan to allocate them, you can use char * strings[SIZE]; or char strings[NSTRINGS][SIZE];

safe halo
#

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

north stream
#

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

somber gazelle
#

What

#

So I've got a Wemos D1 Esp-Wroom-02 I'm trying to develop for

#

but I keep getting this error:

#

It does run on it but only flashes the green and blue led but doesn't do anything with my screen

cedar mountain
#

That doesn't look like a compile error, just statistics about your compiled binary.

somber gazelle
#

Then why is it happening when it wasn't before?

cyan jasper
#

it doesn't happen for Arduino products because arduino compiler be like that

somber gazelle
#

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 ๐Ÿ˜›

somber gazelle
#

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

rain crown
stuck coral
#

What sensor and library are you using?

rain crown
#

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

stuck coral
#

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?

rain crown
#

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

stuck coral
#

Well it would be nice to see the whole thing if you're giving out a pastebin

rain crown
#

sure - one sec

stuck coral
#

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

rain crown
#

you're exactly right - it can go negative

#

it reads both positive and negative pressures

stuck coral
#

Okay, just so I'm on the exact same page could I have a pastebin of the serial output?

stuck coral
#

Aha, because you are storing a float in an int

rain crown
#

aha! So change it to float on the init?

stuck coral
#

I would either change your unit of measurment or change both maxReading and minReading to floats yes

rain crown
#

that did it!! thank you!!

stuck coral
#

Np! Glad to help

rain crown
#

I hate it when I make stupid mistakes like that.... the nature of programming I suppose... at least it wasn't a missing ; hahah

stuck coral
#

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

rain crown
#

HAHAHA!

pine bramble
#

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.

north stream
#

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.

pine bramble
#

im sorry im a noob and dont quite know how to do that

north stream
#

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.

pine bramble
#

ok

#

copy paste what you stated before?

north stream
#

First ```
cd /Applications/Arduino.app/Contents/MacOS

#

Then ```
./Arduino

pine bramble
#

it says no such file or directory

north stream
#

Hmm, perhaps Arduino is installed in an unusual place for some reason.

pine bramble
#

the weird thing is, it worked and then suddenly decided to not open. no error messages or anything

north stream
#

That is weird.

pine bramble
#

the IDE is in my applications folder

north stream
#

Your own Applications folder, or the system Applications folder?

flint smelt
#

Well I'm super excited! I just pinched 6fps from my PyGamer by writing a 32bit memcpy function!

steel zenith
#

Hello

flint quarry
#

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

fathom stone
#

Hello, anyone have any experience with uploading code to esp-01s via arduino? I just can't make them talk to each other

north stream
#

@flint quarry Sounds like you have code that tests the switches individually so it's changing back and forth really rapidly

flint quarry
#

ah, sounds likely, do you know how to fix it, delay maybe?

north stream
#

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);

flint quarry
#

@north stream thank you, it works perfectly now

elder hare
#

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!

mossy plume
#

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 ?

elder hare
#

Yea pin and num_leds

#

Im still unsure about how todo this

mossy plume
#

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.

elder hare
#
exit status 1
invalid use of template-name 'MYFASTLED' without an argument list

and it highlights this

MYFASTLED *STRIP1;
mossy plume
#

It needs the <##> after it.

#

MYFASTLED<22> or whatever.

#

If it's inside the class, use the variable name.

#

MYFASTLED<DataPin, NumLeds>

elder hare
#

it's outside

#

if you look at the code you see i call

MYFASTLED *STRIP1;

at the very bottom after i close the class

mossy plume
#

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.

elder hare
#

hmm

mossy plume
#

There's more going on under the hood, but it's harder to expain.

elder hare
#

cause in my setup i use

STRIP1 = new MYFASTLED(22, 72);
mossy plume
#

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.

elder hare
#

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

mossy plume
#

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

#

What is your experience level with C++?

elder hare
#

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);

mossy plume
#

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.

elder hare
#

yea it shouldn't be a problem

mossy plume
#

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.

elder hare
#

hmmm

elder hare
#

@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?

unique agate
#

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)

north stream
#

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.

unique agate
#

ight thank u

onyx acorn
#

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/

smoky sun
#

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.

cedar mountain
#

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.

mighty vigil
#

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.

smoky sun
#

Thanks, appreciate the help

cyan jasper
#

@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

smoky sun
#

@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.

leaden walrus
jolly hearth
#

yes

#

i assumed it was a bluefruit as it includes a bluefruit library

#

actually in the code is says it is a adafruit

leaden walrus
#

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

jolly hearth
#

ahhh that makes sense, thanks for that!

#

it does work at this point but the reading dont seem correct yet..^

leaden walrus
#

"up" implies "power"

jolly hearth
#

i kinda figured that, still learnig.. thank you

leaden walrus
#

but probably better to say "v logic" (or similar) instead of "power"

#

just in case they are different

jolly hearth
#

i just connected it via bluetooth to the adafruit app and it acutally seems to work there on the plotter. so maybe not necessary

leaden walrus
hollow imp
#

Hello, i'am french

reef ravine
#

bonjour!

hollow imp
#

Bonjour, je ne suis pas seul

#

super

reef ravine
#

i'm sorry "bonjour" is the limit of my French

hollow imp
#

Ah ok

#

I'm sorry, I'm going to write with a translator

cyan jasper
#

Bonjour, je ne suis pas seul
En effet, Tu ne suis pas seul ๐Ÿ™‚

#

but no im not french

hollow imp
#

Ok; Super

cyan jasper
#

just know some

hollow imp
#

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

reef ravine
#

can you post a schematic and your code to pastebin or gist?

hollow imp
#

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();
}```
cyan jasper
#

apart from the topic, why do you read buttons with jk flip flops? (thats interesting and you might know something i don't)

hollow imp
#

We are working on already existing electronic cards

cyan jasper
#

ahhh alright

reef ravine
#

Google translate:
Cela semble intรฉressant, je suis au travail maintenant mais je peux l'รฉtudier plus tard.

cyan jasper
#

I guess i'll reseach that today ๐Ÿ™‚

hollow imp
#

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 :

pine bramble
#

works

hollow imp
#

@reef ravine @cyan jasper google traduction: thanks for your help

reef ravine
#

@hollow imp
Vous รชtes les bienvenus, il faudra plusieurs heures, je suis prรจs de New York.

hollow imp
#

what do you mean?

#

Ah yes the time difference

pine bramble
#

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.

cyan jasper
#

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

pine bramble
#

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).

cyan jasper
#

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

hollow imp
#

@pine bramble your message is related to my project?

pine bramble
#

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).

hollow imp
#

Even GPIO is essentially a 'clocked' event

pine bramble
#

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 (?)

hollow imp
#

i tried different ways and tests. you think my code is approaching proper functioning?

pine bramble
#

(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).

hollow imp
#

my problem is mainly on the management of common addressing between the reading of the buttons and the writing of the leds

pine bramble
#

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.

hollow imp
#

the problem with serial port is that they delay treatment

pine bramble
#

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).

cyan jasper
#

if you arent multiplexing LEDs a LED update function can help

hollow imp
#

yes, it is a large remote control with buttons and leds

cyan jasper
#

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

pine bramble
#

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.

cyan jasper
#

maybe you can use timer interrupt to refresh LEDs 30 frames per second

pine bramble
#

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.

hollow imp
#

I'm sorry but you really lost me

pine bramble
#

That'll be my fault. ;)

#

I'm explaining (briefly) a similar project with similar goals.

#

And how I'm approaching it.

hollow imp
#

I thought that working with a multiplexer would be simpler than that

pine bramble
#

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).

hollow imp
#

IC 13 sur le shcรฉma (74hc138n

pine bramble
#

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.

hollow imp
#

Yes, I can write the LEDs and read the LEDs individually

pine bramble
#

This way it triggers the human memory of what that chip is and does.

hollow imp
#

Lun 74hc138n is used to manage columns (8) for writing leds and reading buttons

pine bramble
#

_
000 001 010 011
100 101 110 111

#

Three to 8. ;)(

hollow imp
#

Yes

#

So in my case the columns

pine bramble
#

What's the complete circuit on the output side of the 3:8 decoder?

hollow imp
#

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

pine bramble
#

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.

hollow imp
pine bramble
#

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.

hollow imp
#

How should I do it?

pine bramble
#

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.

hollow imp
#

yes

#

3 to 8 select the columns to write or read

pine bramble
#

Outputs are active LOW.

#

So this chip 'completes the ground circuit'.

#

You can use an array of Darlington transistors to drive the other end.

hollow imp
#

do we have to add components?

pine bramble
#

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.

hollow imp
#

It is an already existing card

pine bramble
#

The graphic you reproduced was scaled pretty low in resolution.

hollow imp
#

I will make it bigger

pine bramble
#

That would be very useful. ;)

hollow imp
#

It's better?

pine bramble
#

Much better.

#

IC12 74HC244N

#

RB5 10k x 8

#

Looks like RB5 are 10k pullups on the 244N outputs.

hollow imp
#

74HC244N is a bus buffer with 3-state outputs

#

Yes

pine bramble
#

Most of those chips look like buffers by glancing at the part numbers.

hollow imp
#

If you don't press a button everything is at 5v

pine bramble
#

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)

hollow imp
#

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

pine bramble
#

Pins 5 and 4 on the 74HC138 of IC13 are tied to ground.

hollow imp
#

Yes

pine bramble
#

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.

hollow imp
#

I do not know if this can help, but before wiring the arduino, it was a TMP82c79p

pine bramble
#

What is that, basically? Any ideas?

hollow imp
#

Like that? Sorry my translation is not terrible

pine bramble
#

IC13 (outputs) are on a 3-device bus consisting of IC13, IC14 (74HC244N) and IC15 (74HC240N).

hollow imp
#

IC15 is used to lock the LEDs

pine bramble
#

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.

hollow imp
#

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);
}
pine bramble
#

The code doesn't really matter if I don't understand the schematic. ;)

hollow imp
#

PORTC corresponds to 3 of 74hc138n

#

Ok

pine bramble
#

Looks like R0 thru R7 near IC12 are data acquisition, from the point of view of the Arduino.

hollow imp
#

Yes

pine bramble
#

Very simply what is read from them?

hollow imp
#

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
pine bramble
#

Okay so it's passing data from 74HC138N.

hollow imp
#

no

#

The data of 74hc138n is used to select the column and R0 to R7 the lines

#

output 74hc138n :

pine bramble
#

A complete schematic would be far more useful here.

#

Same good resolution as that last segment.

hollow imp
#

000 : colums 1
001 : colums 2
010 : colums 3
...

R0 = ligne 1
R1 : ligne 2
...

pine bramble
#

I'm still very unclear on columns and lines as I don't yet understand the context.

hollow imp
#

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

pine bramble
#

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)

hollow imp
#

I know less than you

pine bramble
#

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.

hollow imp
#

Yes

#

red et yellow

pine bramble
#

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.

hollow imp
#

No, it is high-end equipment which is more than 20 years old

pine bramble
#

B and C are the pb switch terms and the other three are for the LED's.

hollow imp
#

We have all the technical diagrams which are very rare and sought after

pine bramble
#

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. ;)

hollow imp
#

What do you mean?

#

The translation is not very clear and so is my English

pine bramble
#

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.

hollow imp
#

For rows but not columns, the colonens are managed by the 74hc138n

#

Ah yes

pine bramble
#

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)

hollow imp
#

yes

pine bramble
#

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.

hollow imp
#

ASSW-0 to ASSW-3 goes through 74hc138n

pine bramble
#

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.

hollow imp
#

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

pine bramble
#

They are rows. not columns. ;)

hollow imp
#

Ok

pine bramble
#

In your pushbutton matrix diagram.

#

Those small radius 1/4 circle paths on 90 degree bends.

#

Those are cable harnesses (parallel wires bundled together).

hollow imp
#

ok

pine bramble
#

They fan out once having turned that 90 degrees.

hollow imp
#

Okay

pine bramble
#

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).

hollow imp
#

yes

#

It is very clear. that's how I understood the diagram

pine bramble
#

CN1 (upper left) shows pins 18 20 22 24 26 28 30 32 mapped to A-SW 0 thru 7.

hollow imp
#

Yes

pine bramble
#

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).

hollow imp
#

CN4 is another matrix of buttons and LEDs

pine bramble
#

I'm guessing IC12 is where the buttons get read.

hollow imp
#

yes, IC12 is connected on the arduino

pine bramble
#

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.

hollow imp
#

I didn't understand the translation sorry

#

Yes

pine bramble
#

I'm right at the edge of understanding. This has to happen in my brain before I can type it in English. ;)

hollow imp
#

It's exactly that

#

Sorry, I'm french

pine bramble
#

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. ;)

hollow imp
#

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

pine bramble
#

I'm not yet very clear on where the problem is.

hollow imp
#

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

pine bramble
#

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.

hollow imp
#

S0, S1, S2 must keep the same value

pine bramble
#

I would reset them. Or set them, depending on the logic, but all three the same state (HIGH or LOW).

hollow imp
#

At each loop?

pine bramble
#

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.

hollow imp
#

It changes the LEDs if I change the state of s0, s1, s2

pine bramble
#

Right so the LED's aren't latching at all.

#

That may very well be the design goal.

hollow imp
#

If it locks but by line so I have to loop to turn on several LEDs at the same time

pine bramble
#

So I would ignore the LED's entirely, as first approximation, and get just the pushbutton reading working perfectly.

hollow imp
#

The buttons alone work perfectly

pine bramble
#

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. ;)

hollow imp
#

It was intended as original

pine bramble
#

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.

hollow imp
#

I'm going to show you my independent code that works perfectly

pine bramble
#

In this case you need to employ 'video blanking' to get the correct human-visual response.

hollow imp
#

C'est bien ca

#

That's right, it turns on and off quickly

pine bramble
#

So if you operate it very slowly it'll look different to a human. ;)

hollow imp
#

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

pine bramble
#

what's envoi in english?

hollow imp
#

send

pine bramble
#

Nice. ;)

#

We use the same word as a synonym for 'ambassador' and it is a person, a diplomat, I think.

hollow imp
#

PORTC = input 74hc138n

pine bramble
#

('someone sent' ;)

hollow imp
#

Yes

pine bramble
#

I would PORTC = B00000000; // 3:8 decoder, energize PB array

hollow imp
#

We only use the first 3 bits

#

PORTC = B00000111;

#

for example

pine bramble
#

Right.

hollow imp
#

Yes

pine bramble
#

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.

hollow imp
#

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

pine bramble
#

what does bringing 41 low do?

hollow imp
#

It is to lock and unlock the leds

pine bramble
#

74HCT240N IC15 input on pins 1, 19 signal name is /BD I think that may be pin 41 there.

hollow imp
#

Yes

#

/BD is display blanking input

#

HIGH default

pine bramble
#

Pin 19 is 2/OE (output enable input, active low)

#

So it's gating the line driver on or off.

hollow imp
#

So am I good?

pine bramble
#

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.

hollow imp
#

If I don't do that, the LEDs won't get blocked

pine bramble
#

'blocked' is confusing to me.

hollow imp
#

I've been doing it for days and days

pine bramble
#

My ignorance is to your benefit, really. You can see where I had to assemble in my mind what was going on.

hollow imp
#

assets if you prefer

pine bramble
#

;)

#

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. ;)

hollow imp
#

Yes, I see, but it's not in programming that it's wrong

#

I also think but it's very frustrating not to find

pine bramble
#

Well, try solving only the output problem (the LED's) and ignore the pushbutton array, entirely.

#

Pushbutton acquisition involves hysteresis.

hollow imp
#

When I do everything works for LEDs

pine bramble
#

(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.

hollow imp
#

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

pine bramble
#

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.

hollow imp
#

This is the case, the LED does not light up when the button is pressed

pine bramble
#

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.

hollow imp
#

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

pine bramble
#

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.

hollow imp
#

We can turn on several leds without loop only if they are in the same line

pine bramble
#

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.

hollow imp
#

there are 8 bits for the lines and 8 bits for the 3 to 8 for the columns

pine bramble
#

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.

hollow imp
#

That's what I do

pine bramble
#

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?

hollow imp
#

yes

pine bramble
#

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. ;)

hollow imp
#

about 1millis6

pine bramble
#

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.

hollow imp
#

After the leds are not identical and weaker

pine bramble
#

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?

hollow imp
#

There is one color per button either red or yellow

pine bramble
#

Okay. I'm not sure then why two LEDs per button position.

#

It's near 19:00 here so I have to leave. ;)

hollow imp
#

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 ๐Ÿ˜‰

pine bramble
#

I'm sure plenty will read this and one may know something obvious to them but not to us!

#

Nice to meet you.

hollow imp
#

The pleasure is shared

pine bramble
#

"A primate put this together. A primate can take it apart." .. my friend, to himself, dismantling an automobile engine down to individual parts. ;)

hollow imp
#

Indeed, each person sees things differently

#

Wishing you a pleasant evening, I'm going to sleep

pine bramble
#

๐Ÿ›ฉ๏ธ ๐Ÿ›ฉ๏ธ

cyan jasper
#

does anyone know if i can use timer 1 input capture interrupt and servo library?

verbal path
#

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)

tough snow
#

@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

verbal path
#

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?

tough snow
#

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

verbal path
#

@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?

tough snow
#

I'm not 100% sure, I haven't ever had them in my possession

verbal path
#

That's fine. i reached out to support already ๐Ÿ™‚

timid sail
#

@verbal path in my experience with addressable strips red is 5v, black is gnd, and green is data

verbal path
#

Thanks @timid sail that's what I'm leaning towards!

timid sail
#

np

tardy hill
#

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.

timid sail
#

are you scaling the value or just trying to pass it in?

tardy hill
#

are you scaling the value or just trying to pass it in?
@timid sail sorry, i dont understand, how its scalling? and why?

timid sail
#

when you check the value using the monitor are you seeing just 24 or 24.00?

tardy hill
#

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

timid sail
#

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

tardy hill
#

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?

lyric echo
#

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

stuck coral
#

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

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

stuck coral
#

Which arduino? Arduino is a C framework. And you didnt answer my question on the temp sensor

lyric echo
#

arduino uno board, the temperature sensor is a TMP36

#

it reads an analog voltage

stuck coral
#

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

lyric echo
#

ok thanks

#

what are the D0 and D1 pins for

#

and I use those for anything

stuck coral
#

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

lyric echo
#

ok thanks

cyan jasper
#

Uart connected to USB converter chip (can be used as io but frowned upon)

lyric echo
#

also how do I wire, a DIP DPST Switch

#

it has a1,a1,b1,b2

#

only one switch

stuck coral
#

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

lyric echo
#

is there a way to just make it power the circuit

#

the whole thing

#

and then shut it down when its switched off

stuck coral
#

Yeah, just connect power to a and thing to b

#

Or the other way around, it is just a switch

cedar mountain
#

Watch out for current limits with DIP switches, though, as the contacts aren't rated for much.

hybrid fossil
#

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?

stuck coral
#

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

potent abyss
#

Can i use anolog pin for HC-05 module? Used it for L293D+ arduino.

cyan jasper
#

If you're using software serial you can

hybrid fossil
#

@stuck coral why unpopular?

proven mauve
#

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...

stuck coral
#

@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

pine bramble
#
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).

elder hare
#

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?

proven mauve
#

@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

pine bramble
#

You can't just copypasta this.

proven mauve
#

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

pine bramble
#

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. ;)

proven mauve
#

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

pine bramble
#

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.

proven mauve
#

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

pine bramble
#

Maybe you can link the complete code base; talking about code in the abstract has limited usefulness. ;)

proven mauve
#

haha, I get what you mean

#

Let me set up a github for it real quick

pine bramble
#

I routinely solve and understand code I cannot explain, lacking the vocabulary and many concepts to do so. ;)

proven mauve
#

โค๏ธ I really appreciate the help, as always

pine bramble
#

My debugging is very much compiler-error message driven. ;)

proven mauve
#

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

pine bramble
#

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.

proven mauve
#

lolol

hollow imp
#

Hello @pine bramble , I absolutely wanted to inform you that we have managed to do the right thing. Thank you for your analysis.

pine bramble
#

@hollow imp That's great! I hope our conversation at least ruled out a few dead end investigations. ;)(

#

("Hope is not a strategy.")

proven mauve
#

@pine bramble can I ask your github name so I can invite you to it?

pine bramble
#

wa1tnr

#

My ham call.

proven mauve
#

๐Ÿ˜„

pine bramble
#

dah-di-dah-dit, dah-dah-dit-dah since 1974 ;)

proven mauve
#

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

pine bramble
#

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).

proven mauve
#

is 15m the wavelength?

pine bramble
#

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).

proven mauve
#

DId you get the invite?

pine bramble
#

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.

proven mauve
#

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.

pine bramble
#

I have no idea where to look.

#

It may've emailed me though.

#

got it. was email driven.

proven mauve
#

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

pine bramble
#

We're not yet at wringer level of brain strain. ;)

#

wow git command line is making me login to clone your repo.

proven mauve
#

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

pine bramble
#

New branch for any suggestions I make.

#

If you refresh you'll see it in the webbed interface.

proven mauve
#

kk

#

that's really handy

pine bramble
#

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?

proven mauve
#

leonardo

#

Using "MIDI Library" and "USB-MIDI" in the library installer

#

I think Wire and EEPROM are the only other two I'm using

pine bramble
#

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. ;)

proven mauve
#

lol, one sec

#

That on should compile clean using the same libraries

#

It's all that one .ino, no .cpps or anything

pine bramble
#

It didn't, so I may have an extra lib available it's referring to, or I may be missing one.

proven mauve
#

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

pine bramble
#
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

proven mauve
#

that be the one

pine bramble
#

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.

proven mauve
#

they are different types of objects tho I think

#

but yes, both are going to have this error issue

pine bramble
#

I may be in the wrong directory entirely. ;)

proven mauve
#

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

pine bramble
#
 $ ag midi | wc -l
60

for the breadboard version. ;)(

proven mauve
#

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

pine bramble
#

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)

proven mauve
#

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

pine bramble
#

timerHandler() isn't visible when I split out the files.

north stream
#

Is MIDI an object that's automatically instantiated by the header file, or is it explicitly instantiated in the .ino file?

proven mauve
#

explicitly instantiated in the .ino file, in setup()