#help-with-arduino

1 messages · Page 79 of 1

north stream
#

Does it get the configuration information like IP address, netmask, DNS server, etc.?

#

Or are you using Zeroconf/Bonjour or somesuch instead of DHCP?

elder hare
#

@north stream hmm i uploaded a simple wifi sketch and well... now it seems STUCK

Connecting to Altibox625721
................ still trying to connect
................ still trying to connect
................ still trying to connect
................ still trying to connect
.....
#

:S

north stream
#

Looks like a step backwards if WiFi was working previously 😦

elder hare
#

yea :/

#

if i follow the via i can see that it is connected to EN pin on the ESP32

so it was connected / touching the reset button on the one end and the other was soldered to the via

#

sketch

#include "WiFi.h"

void setup() {
  Serial.begin(115200);
  
  WiFi.mode(WIFI_STA);
  WiFi.begin("SSID", "PASSWORD HERE");
  Serial.print("Connecting to "); Serial.println("Altibox625721");
 
  uint8_t i = 0;
  while (WiFi.status() != WL_CONNECTED)
  {
    Serial.print('.');
    delay(500);
 
    if ((++i % 16) == 0)
    {
      Serial.println(F(" still trying to connect"));
    }
  }
 
  Serial.print(F("Connected. My IP address is: "));
  Serial.println(WiFi.localIP());
}

void loop() {
  // put your main code here, to run repeatedly:

}
north stream
#

Maybe print out what the WiFi status is, while it isn't connected yet?

safe shell
#

Also check to see if you can scan wi-fi, that doesn't require a connection, but will tell you if wi-fi is functional

#

You can also set up an event handler WiFi.onEvent(WiFiEvent); to catch (and print) any events (and error codes) related to wi-fi

pine bramble
#

I got 2 LED's, one has VIN 12V and one has DIN 5V, whats the difference between VIN and DIN and can I plug either of them into D4

#

I was orignally going to control them with ESP8266 but i ordered wrong voltage one

#

and the one I see on amazon now has a D4 connector, not DIN

#

so I wana make sure my DIN on LED's will be able to work with D4

#

please tag me if u reply

north stream
#

DIN is normally "data in". The ESP8266 is a 3.3V module, so you'd need a level shifter to drive a 5V DIN from it.

woven wedge
#

What I'm trying to do is use an arduino micro in place of the teensy here

woven wedge
#

Actually it's just a serial connection into the teensy and then keys are sent, I didn't quite understand it fully

winter mason
#

Hello I am having a problem with a non-arduino device but it is programmed using arduino software, can I ask about it here?

wraith current
#

@winter mason sure

winter mason
#

I have an esp8266-01S which I am trying to program using the arduino ide, I can upload sketch’s and flash firmware but no matter what I try, any sketch, any baud rate I cannot get the device to respond in the serial monitor

wraith current
#

@winter mason you can't get anything to print in the serial monitor or are you trying to type into the serial monitor and get a response.

#

?

winter mason
#

I am not getting any response in the serial monitor

wraith current
#

what do you mean by response ?

winter mason
#

If I type something in nothing happens

#

Completely blank

wraith current
#

does your program listen for input from the serial port ?

winter mason
#

Yes

wraith current
#

have you matched the baud rate in the serial port with the baud rate used in the program ?

winter mason
#

Yes

#

I have tried with 9600 and 11520

wraith current
#

what speed is used in the Serial.begin line of your program ?

winter mason
#

9600

#

A problem that I am getting though it doesn’t like the line ESPserial.begin(9600) and any other line starting with espserial

wraith current
#

Does Serial.begin(9600); work ? I"ve never seen ESPserial.begin before.

winter mason
#

The program I am using uses both espserial.begin and serial.begin, espserial gives an error so I removed the line I get these problems with the serial monitor

wraith current
#

The serial monitor in arduino works on the Hardware serial connection. That example you have uses ESPserial as a softwareserial port. Post your code in three backticks like this code here

#

back tick is the symbol underneath the ~

#

`

#

``` code here ```

winter mason
#

`#include <SoftwareSerial.h>
SoftwareSerial ESPserial(2, 3); // RX | TX
void setup() {

Serial.begin(9600);
ESPserial.begin(9600); //errors
Serial.println("");
}

void loop() {
if ( ESPserial.available() ) { Serial.write( ESPserial.read() ); }
if ( Serial.available() ) { ESPserial.write( Serial.read() ); }
}`

wraith current
#

ok, so why are you using two serials then ? If you want the chip to echo what you type back to you in the same serial window then use the same Serial object like this :

winter mason
#

i removed the espserial.begin line

wraith current
#

if ( Serial.available() ) { Serial.write( Serial.read() ); }

winter mason
#

still not working

#

if I unplug and plug in with the serial monitor open i get a backwards question mark (⸮)

#

i can get it to say the "ready" message when it boots up but it still doesnt respond to commands

winter mason
#

now i am getting errors

#

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

north stream
#

@woven wedge I didn't fully understand it either (hence my questions). Did you get it working?

pine bramble
#

Hey guys, is it possible to trigger an interrupt on falling edge of pwm output?

#

im measuring a thermocouple thats in series with a heater so i have to either measure when it's not on or turn it off while measuring

#

(the thermocouple is amplified if thats relevant)

north stream
#

It may be possible to do so via a timer interrupt. Alternatively, connect the PWM pin to an interrupt pin and configure that pin to interrupt on a falling edge.

pine bramble
#

yeah i thought of that too but i thought maybe timer interrupt would work better?

north stream
#

That's why I suggested the timer interrupt first, as it doesn't require an extra pin and wiring.

obtuse spruce
#

what MCU are you using, @pine bramble ? if it is SAMD21 or 51, then you can definitely interrupt on negative edge of the PWM directly in the chip.

pine bramble
#

atmega328p aka arduino uno

distant condor
obtuse spruce
#

@distant condor - code isn't like wiring - digitalWrite(LED_BUILTIN, state); doesn't connect state to the pin, but only writes the value exactly once when the line of code is executed.

Changing state somewhere else won't immediately change the pin..... Only when a call to digitalWrite is made again. So you need to arrange to call it each time you change state:

void blink()
{
  state = !state;
  digitalWrite(LED_BUILT, state);
}
#

Now - you also need to arrange to call blink() again and again....

#

Fortunately, we have loop().... now loop() is "special" in that it (and only it) is called again and again and again, forever, after startup() is called at the start.

#

(Note: only these two functions are "special" this way. Other functions you write are only called, if you call them.)

distant condor
#

yup understood i just imagined that whenever interrupt changes state it calls blink changing state and on the next ineration of the loop the led changes

obtuse spruce
#

So... you might be tempted to write:

void loop() {
  blink();
}

...which will call blink repeatedly... but it will be too fast!

#

Nothing in your sketch's code connects blink to an interrupt.

#

whoops

#

missed that line

distant condor
#

yeah lol made me question my life choices

obtuse spruce
#

sorry - seems like such a common mistake I see here: people call an output function once and expect the variable to bound to the pin forever!

#

OKAY - so - hrm....

#

so you see the Serial write output showing pin 2 changing?

#

do you need to pinMode(2, INPUT) perhaps - (possibly with pull up?)

distant condor
#

yup

#

oh well that could be it but in the long run i plan to attach pin 2 to a encoder

obtuse spruce
#

also - just double checking - are you sure pin 2 is interrupt capabale on your particular board?

distant condor
#

well i actually didnt know that mzero though all pins were capable of interrupts

#

its a arduino uno

#

well it seems that it is capable

#

in the docuentation

obtuse spruce
#

yup - just checked, too

distant condor
#

made those pinmode changes but it seems to be the same

#

led stick to low if thats initiated or high if thats initiated

#

but in serial monitor i can see th epin 2 changing values

#

just found out change in pin 2 doesnt even call the fucntion blink

obtuse spruce
#

(side note: if you include code blocks rather than images, it will be a bit easier to read... I keep having to zoom my page to read your code!)

distant condor
#

whats the html or disco tag for including code blocks? sorry noob here

obtuse spruce
#

no prob: three backticks (`) and "C++" then code on the following lines -- and end with a line of just three backticks

distant condor
#
int pin = 2;
volatile byte state = LOW;

void setup()
{
  Serial.begin(57600);
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(pin, INPUT);
  attachInterrupt(2, blink, CHANGE);
}

void loop()
{
  digitalWrite(LED_BUILTIN, state);
  
}

void blink()
{
  state = !state;
  Serial.println(state);
}```
#

got it sorry for spam

obtuse spruce
#

I don't think you can Serial.println from within an interrupt routine.

distant condor
#

oh ok

obtuse spruce
#

BUT - try this: set state = LOW at top... Then state = HIGH; inside blink()

#

This will test if it is ever called. As you have it --- were it to be called twice in a row quickly - you'd never see it

#

And - since I don't know what it causing 2 to change - perhaps that is possible. Because you set CHANGE - every trigger (button press?) will cause 2 interrupts.

distant condor
#

i am just plugging the wire from pin2 to 5v or gnd to test

vivid rock
#

note that this typically generates multiple interrupts

#

as the voltage jumps up and down before settling on a new value; google "button debouncing"

distant condor
#

ohh ok ive noticed that in my plotter

#

i think

vivid rock
#

but indeed, as @obtuse spruce suggested, first thing to check would be to verify if blink() ever gets called at all

distant condor
#

I just checked and blink doesnt get called

#

also i set the pin 2 to INPUT_PULLUP yet the value remains zero in the monitor

#
int pin = 2;
volatile byte state = LOW;

void setup()
{
  Serial.begin(9600);
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(pin, INPUT_PULLUP);
  attachInterrupt(pin, blink, LOW);
}

void loop()
{
  digitalWrite(LED_BUILTIN, state);
  Serial.println(state);
}

void blink()
{
  state = !state;

}```
#

the value of 2 is continously GND never even gets pulled up

gilded swift
#

Change state to an int type

distant condor
#

i found something

gilded swift
#

Most examples for setting state use int type

distant condor
#

digitalPinToInterrupt(pin).....is required instead of just pin

#

and it seems to be working now kinda

#

got it working guys with this code ```c++
int pin = 2;
volatile byte state = LOW;

void setup()
{
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
pinMode(pin, INPUT);
attachInterrupt(digitalPinToInterrupt(pin), blink, CHANGE);
}

void loop()
{
digitalWrite(LED_BUILTIN, state);
Serial.println(digitalRead(pin));
}

void blink()
{
state = !state;

}```

gilded swift
#

Good job 🥳🎉

#

Always a great feeling when code works

distant condor
#

also i found soemthing interesting if you put NULL in place of ISR like so c++ attachInterrupt(digitalPinToInterrupt(pin), NULL, CHANGE); a digital read on the pin in question gives garbage values like hexadecimal and other binary stuff

#

if used correctly as in the code that worked it only gives the desired 0 or 1

#

also a digital pin constantly oscillates between 0 and 1 if not connected to any output....

obtuse spruce
#

good find on both counts, @distant condor

distant condor
#

thanks you guys for all the help good luck coding @obtuse spruce @gilded swift

raven wing
#

Hey all

#

I have an Arduino Pro Micro, a 9v batter+harness, a DC motor, and a vibration sensor. Being it's my first day dealing with electronics like this, I was wondering if you can help me wire these together such that when the sensor is closed, the motor spins.

#

My main question is power, right now. How do I get maximum voltage to the motor while maintaining 5v or so to the sensor?

#

If these questions don't make sense, please help m correct myself.

cedar mountain
#

Generally you'd want to use USB power for the Micro, since it wants to run on 5V, and can tap into that using the "RAW" pin to power the sensor too. You can wire the motor separately with the 9V if you want to maximize the voltage there, just connecting the grounds. However, you'll need something to control the motor with, like a relay or a transistor, since the Micro can't turn high-current devices like the motor off and on by itself.

raven wing
#

Very helpful, thanks!

#

What would a relay or transistor look like?

#

Or, is there a better microcontroller for me? Size is a big factor.

#

I'm googling it now, fyi

#

Note: motor direction is not important, nor is speed control.

cedar mountain
raven wing
#

Gotcha

cedar mountain
#

If you're just getting started, it's a good idea to follow an established tutorial rather than necessarily improvise, as there are a lot of unexpected subtleties in electronics sometimes. 😁

raven wing
#

I hear you. I've been doing a lot of piecemeal research and I feel like my needs are quite specific. It's hard to find a tutorial that does what I need, you know?

#

But to be fair, my needs could be considered very general to you. I'm too new to even tell.

#

Based on an article I just read, a transistor seems like it'd be a better option?

cedar mountain
#

It would work and be pretty cheap, yep. Picking a particular transistor can be tricky sometimes, though.

raven wing
#

I have no idea what it means, but I'm buying some NPN PN2222s

#

shrug

obtuse spruce
#

your in luck, @raven wing - that tutorial uses.... a PN2222!

raven wing
#

Nice!

#

What sucks is, I'm not even sure I need an arduino for this project.

winter mason
#

I finally managed to (kind of) get my esp-01 board to work
i found a working sketch that would make the led blink, i modified it to work with serial commands, the current code is

SoftwareSerial ESPserial(2, 3); // RX | TX

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output
  Serial.begin(9600);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, LOW);   // Turn the LED on (Note that LOW is the voltage level
                                    // but actually the LED is on; this is because 
                                    // it is acive low on the ESP-01)
  delay(1000);                      // Wait for a second
  delay(250);                      // Wait for one-quarter of second

  digitalWrite(LED_BUILTIN, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
  delay(250);                      // Wait for one-quarter of second

  if ( Serial.available() ) { Serial.write( Serial.read() ); } 
}```

it will only echo what i type, what would i program to be able to use the AT commands?
woven mica
#

You need to burn AT firmware to use the AT commands

winter mason
#

i flashed the AT firmware and now i get an error Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException every time i type in serial monitor

north stream
#

Perhaps the serial port changed?

low sundial
#

Am I stuck with the arduino IDE or can I run and compile from something like VSCode?

north stream
#

There are other options like Keil, gcc, and Atmel Studio. I think VSCode is more of an IDE than a build system, but I'm not sure.

low sundial
#

Ty gonna look into those options

obtuse spruce
blissful meadow
#

My code just does not work(the buzzer does not buzz and led does not shine) void setup() {
// put your setup code here, to run once:

}
int trigpin = 4;
int echopin = 2;
int led = 11;
int buzzer = 13;
void loop() {
tone(buzzer,600);
analogWrite(led,4);
delay(1000);
noTone(buzzer);
analogWrite(led,0);

}

#

just this part

#

any fixes?

#

Thanks

blissful meadow
#

okay

#

umm was that a answer to this My code just does not work(the buzzer does not buzz and led does not shine) void setup() {
// put your setup code here, to run once:

}
int trigpin = 4;
int echopin = 2;
int led = 11;
int buzzer = 13;
void loop() {
tone(buzzer,600);
analogWrite(led,4);
delay(1000);
noTone(buzzer);
analogWrite(led,0);

}
just this part
any fixes?
Thanks

reef ravine
#

@blissful meadow what board are you using? (and the answer before related to formatting your code so it reads easier in discord)

blissful meadow
#

Onu

#

r3

#

@reef ravine Onu R3

reef ravine
blissful meadow
#

okay

#

thanks

reef ravine
#

Use of the tone() function will interfere with PWM output on pins 3 and 11

blissful meadow
#

okay

#

anything else?

reef ravine
#

if you leave the PWM out of it does the buzzer buzz?

blissful meadow
#

what is PWM

reef ravine
#

the analogWrite(led, 4); sets the Pulse Width Modulation on pin 11 to a value of 4 (out of 256)

blissful meadow
#

oh

#

give me a second

#

let me set up my project

#

nope with out analogWrite(led, 4); it does not buzz

#

void setup() {
// put your setup code here, to run once:

}
int trigpin = 4;
int echopin = 2;
int led = 11;
int buzzer = 13;
void loop() {
tone(buzzer,600);

delay(1000);
noTone(buzzer);

}

#

thats what i have

reef ravine
#

to make it easier to read format it with "backtics"

blissful meadow
#

okay

#

all I have is tone(buzzer,600);
delay(1000);
noTone(buzzer);

#

on a loop

reef ravine
#
int trigpin = 4;
int echopin = 2;
int led = 11;
int buzzer = 13;

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  tone(buzzer,600);

  delay(1000);
  noTone(buzzer);
}```
#

pin 13 is connected to the onboard LED

blissful meadow
#

there is no on board led(i did add one on pin 11)

#

i put the buzzer on pin 13

reef ravine
#

is it an UNO R3?

blissful meadow
#

Ya

reef ravine
#

there is an LED connected to pin 13

blissful meadow
#

But then why is there a pin for pin 13?

#

mine is old

#

I change it to pin 8

#

the buzzer

reef ravine
#

try

void setup() {
  // put your setup code here, to run once:
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
}```
blissful meadow
#

okay

reef ravine
#

you should see an LED blink

blissful meadow
#

nope saw none

#

well just RX TX

#

when i was uploading

reef ravine
#

sorry, add another delay after digitalWrite(13, LOW);

blissful meadow
#

okay

#

wait

#

l is blinkinh

#

L

#

yellow light

reef ravine
#

ok, that is the basic "Blink" sketch found in "Examples"

#

so until you gain some experience try to avoid using pin 13

blissful meadow
#

okay

#

yup I only done 1 project

#

with this languag

#

e

reef ravine
#

you'll get used to it 🙂

blissful meadow
#

but how will My buzzer work?

reef ravine
#

try rewriting your code to blink an LED on pin 8

blissful meadow
#

what pin should i use

#

okay

reef ravine
#

brb (dogs need a walk)

blissful meadow
#

okay

#

thx for helping me

#

brb got to eat

reef ravine
#

Pin 8 does not support PWM, use 9 instead. (It'll blink on 8, but PWM allows you to "dim" the brightness.)

blissful meadow
#

okay

#

but the main led doesn't blick

#

blink

reef ravine
#

is it wired in the correct polarity?

blissful meadow
#

short netive long ground

#

well the short one

#

to 9

reef ravine
#

try flipping it

blissful meadow
#

long one to the common ground

reef ravine
#

and you have a current limiting resistor in series?

blissful meadow
#

no

#

1 led

reef ravine
#

you must use a resistor in series with LEDs to prevent damage

blissful meadow
#

Umm this is a new led

#

and i have 1 resister

reef ravine
#

what value?

blissful meadow
#

ummm I got it with the Super starter kit

#

not sure

reef ravine
#

some value between 220 and 470 will work

blissful meadow
#

I will try to run it with out a resister

reef ravine
#

don't

blissful meadow
#

nope still no light

#

my freind does not have a resister and he uses leds

#

friend*

#

it burn out in a hour of use

#

on 5 votl

reef ravine
#

without them too much current will pass, it'll eventually destroy the LED or worse, the pin

blissful meadow
#

o

#

umm the buzzer does not work

#

is it a wiring issur

#

issue

reef ravine
#

doesn't look like you connected to ground

#

looks like you connected to AREF

blissful meadow
#

I made the common ground the postive wire

#

strip

#

the long leg is on it

reef ravine
#

usually the blue bus is used for ground and the red one for +5v

blissful meadow
#

I never color code my wires

#

I should do that

reef ravine
#

the bus on the breadboard

blissful meadow
#

what do you mean by bus?

reef ravine
#

and yes you'll thank yourself if you use color coded wiring as much as possible

#

the long "rails" on either side of the breadboard, they are blue and red

blissful meadow
#

it will help for more advance projects

#

oh

reef ravine
#

the electrons don't care but I always wire ground to blue, +5v to red

blissful meadow
#

my social distance cap that tazes you if you come to close is not advanced

#

okay

reef ravine
#

lol, a cool and relevant project

blissful meadow
#

thx

#

for now just buzzer and light

#

then taser

pulsar junco
#

@blissful meadow sorry for such a terse reply, I was gonna post more but something came up IRL

blissful meadow
#

lol

#

that happanes

reef ravine
#

your resistor is fine for this

blissful meadow
#

I have built a alarm clock that slaps you if you don't wake up

#

but i haven't used leds

#

yet

#

but i will do that

reef ravine
#

i need an alarm like that - but I wouldn't use it 🙂

blissful meadow
#

umm I did the project

#

but the led doen't light up

reef ravine
#

and if you flip the leads?

blissful meadow
#

FU***

#

i just electiied my self

#

with my taser

#

it when of

#

the servo moverd

reef ravine
#

you OK?

blissful meadow
#

ya

#

it stings

reef ravine
#

step 1: Deenergize taser

blissful meadow
#

umm still doesn't light up

#

and the pin 8 was my servo

#

that was on my arm

reef ravine
#

so you have pin 8 to resistor to LED to ground?

blissful meadow
#

ya

#

how do i check if the led works

#

and it is not getting current

pulsar junco
#

do you have a multimeter?

blissful meadow
#

no

#

but i do use a motor

reef ravine
#

it's hard to see in the picture, what are the colors on the resistor?

blissful meadow
#

blue

reef ravine
#

each stripe

blissful meadow
#

blue,red,blue red,red

reef ravine
#

in that order?

blissful meadow
#

ya

reef ravine
#

hmm sounds like a 62K ohm

#

anything smaller in the kit?

blissful meadow
#

no

#

it does have different resisters

#

like photo, diode, thermo

reef ravine
#

they are likely all the same physical size

#

can you link the kit?

blissful meadow
#

okay

#

they stopped making it

#

but look at this

reef ravine
#

OK, it say it has 120 resistors

blissful meadow
reef ravine
#

different strips should have different colored bands on them

blissful meadow
#

ya

#

they do

reef ravine
#

any red red brown?

#

or orange orange brown?

blissful meadow
#

i have red red blue blue red

reef ravine
#

anything without blue?

blissful meadow
#

no

reef ravine
#

tough without a multimeter...

blissful meadow
#

ya

#

should get it for a xmas present

reef ravine
#

they range from $5US to "how much money you got?" 🙂

blissful meadow
#

resister are only for leds right

#

i can get that

reef ravine
#

resistors are used in every electronic device

#

they limit the flow of current in a circuit

blissful meadow
#

I mean for Arduino

reef ravine
#

you'll also use them in motor drivers, MOSFETs, transistors

blissful meadow
#

ah

reef ravine
#

anytime you deal with the real world as opposed to the micros logic world

#

by choosing the right value you limit the current that you need

#

i think your resistor is so large it limits current through the LED to much

blissful meadow
#

soo

#

I should buy a muit meter

#

(prime day)

#

i wish banggoods day was a thing

reef ravine
#

lol

blissful meadow
#

but what about my buzzer

#

void setup() {
// put your setup code here, to run once:
pinMode(13, OUTPUT);
int buzzer = 5;
int led = 8;
}
int led = 8;
int buzzer = 5;
void loop() {
digitalWrite(13, HIGH);
digitalWrite(led, HIGH);
tone(buzzer,450);
delay(100);
digitalWrite(13, LOW);
digitalWrite(led, LOW);
noTone(buzzer);
delay(100);
}

reef ravine
#

no specs on it either eh?

blissful meadow
#

well it is a active buzzer

reef ravine
#

ok, so it has polarity as well

blissful meadow
#

I checked that

#

it works

#

I"M SOOOO DUMB

#

FUUUUUUU

#

OH MY

#

polarity

reef ravine
#

don't worry - after you have years of experience - it'll still happen to you 🙂

blissful meadow
#

I pulled it out i was like

#

........

#

long side on ground

#

SOOOO DUMB

reef ravine
#

i wouldn't depend on "long side" "short side", always best to check markings on body or test

blissful meadow
#

okay

#

hey want tools do you recommend ?

#

for this

reef ravine
#

do you have a soldering iron?

blissful meadow
#

ya

#

not to good

#

and cheap bangood solder

#

and soilering iron

#

that in bad shape

reef ravine
#

a precise pair of needle nose pliers and a good wire cutter

blissful meadow
#

because of shipping

#

okay

#

why pliers

#

and wire cutter

reef ravine
#

when you make projects you'll often need to wire things, they help to shape parts to fit

pulsar junco
#

I'm gonna drop a hot take and say I think that solid core wire cut to length is better than jumpers. You can get kits of precut if you don't want to deal with cutting it yourself

blissful meadow
#

I have 23131 jumpers

reef ravine
#

for breadboarding yes

blissful meadow
#

idk why

reef ravine
#

(I have my PIR pumpkin in mind 🙂 )

blissful meadow
#

nice

#

But how?

#

hard

reef ravine
#

not hard if you have the 8x8 matrix LEDs

#

mine has a sensor so when the kids walk up it opens its eyes and does effects like that

blissful meadow
#

cool

#

I was thinking something less compilated but cool

#

I have a LCD screen

reef ravine
#

you can always just flicker led eyes with 2 LEDs

blissful meadow
#

oh ya

reef ravine
#

or create a cyclops eye on the LCD

blissful meadow
#

ya

#

but will te ardino be fine?

#

form being on soo long

reef ravine
#

the uno itself runs very cool

blissful meadow
#

humid

#

and

reef ravine
#

you must provide external power for lots of LEDs, motors or other high power things

blissful meadow
#

oh

#

I was always scared

#

to run it more then 30 min

reef ravine
#

the uno itself is fine forever on a USB

#

but not if you are running motors or tasers off it

blissful meadow
#

is there a glitch where TX and RX will stay on?

#

and taser are turned on by a servo

#

some 10 dollar one

#

BUT IT HURTS

#

for 10 seconds

reef ravine
#

a small servo is fine, larger or more need external power

blissful meadow
#

so like a 9g servo max

reef ravine
#

you want to draw less than 250mA to be on the safe side

blissful meadow
#

okay

#

well thanks for helping me

#

I have to study for my math quiz

#

and sleep

#

I didn't realize the time

#

it is 10:17

#

well bye

reef ravine
#

ok, good luck!

formal cradle
#

hey guys I'm having trouble understanding the concept of timer1 regarding how it should be utilized in code.

what makes it so different from using something like

auto time = millis()

to be used in a time sensitive macro for instance?

Like I guess the analogy that this website describes it makes sense but the rest isn't clicking for me
This website
https://deepbluembedded.com/why-use-timer-instead-of-delay/

This is an example of a function I have

void shineshine(){
  auto time = millis();
  while ((millis() - time) < 9){
    senddownb();
    }
  while (((millis() - time) > 9) && ((millis() - time) < 12)){
    sendjump();
    }
  while (((millis() - time) > 11) && ((millis() - time) < 80)){
    senddownb();
    auto time = 0;
    }
}

My goal is to integrate timer1 instead of time = millis()

Is this tutorial, we'll discuss how and why to use timer instead of delay? What are the drawbacks of using time delays within your main loop

obtuse spruce
#

I have to say - I found that site's descirption to be very convoluted and poorly presented. And, er, it didn't even give a working example of using HW timers - nor explain why it can make things harder - since coding with interrupt routines is tricky and requires more complex code.

#

Furthermore, really, for things like sequencing actions like your shineshine does, there are simpler, more clear ways to handle it while still allowing you interleave other processing.

#

But - @formal cradle - if you don't need to do anything else while shineshine is running, there is nothing wrong with writing it using millis() as you have (though I could make some suggestions for making the code more readable.)

#
void shineshine() {
  auto start = millis();
  while (millis() - start <  9) senddownb();
  while (millis() - start < 12) sendjump();
  while (millis() - start < 80) senddownb();
}

assuming you want to mash on downb and jump as fast as possible during those intervals

formal cradle
#

@obtuse spruce Thank you so much for taking the time to respond to me! I guess my issue was that the function I'm running along with the intended game doesn't seem to do the inputs fast enough or at the right time despite using milliseconds. So I had thought that using something like timer1 would remedy that problem. I mean there can be other variables that can affect the timing like the polling rate in the game but I don't know how to measure that let alone use that info and utilize it in my code

But I think I'll try to just keep playing around with the timings

Do you have any recommendations on resources that explain timer1 to a first time/ amateur programmer like me?

dapper swan
#

Hey everyone. I started Uni a month ago (meng), and while every other subject is going well for me, I am completely lost at arduino and I am going to fail my first assignment. Which I came to terms with, but I am looking for a good place to learn. Since my tutorials got really complicated (for my level) from week 2 already, I am absolutely lost. Hopeless. Youtube tutorials also make me lost, so is there a tutorial series that explains everything like I am a 3 year old? I really want to overcome this terrible start and I have no idea what the best place is...

#

The uni assumes you did some coding in school, and I have not, so every little coma, every little operation is a new concept for me. I can copy code, but even if I do, I don't understand it and if there is an error, well, you can be sure it is there to stay because I can't fix it ever

wraith current
#

@dapper swan do you have hardware to play with? You can also use tinkercad to play around in simulation.

dapper swan
#

yeah i have tinkercad access

#

i was looking for some babystep tutorial videos that explain very few new things in each video

#

if i just stare at a code i won't understand anything

wraith current
#

@dapper swan

#

Don't just stare at the code, read the comments, they explain what every line does :

  This program blinks pin 13 of the Arduino (the
  built-in LED)
  
  Try to make the LED blink FASTER!
*/

void setup()
{
  pinMode(13, OUTPUT); // tell the arduino that pin 13 for OUTPUT
}

void loop()
{
  // turn the LED on (HIGH is the voltage level)
  digitalWrite(13, HIGH);
  delay(1000); // Wait for 1000 millisecond(s)
  // turn the LED off by making the voltage LOW
  digitalWrite(13, LOW);
  delay(1000); // Wait for 1000 millisecond(s)
}```
dapper swan
#

thanks i will give that a go

dapper swan
wraith current
#

wow, that's a very programming centric problem.

#

@dapper swan

#

the problem is in line 3

lone ferry
#

Or in line 2.

dapper swan
#

this is the error message and i understand absolutely nothing :D'

lone ferry
#

The first error says that you can't actually do Serial.read(scores[i]).

#

So I guess line 5 is also wrong 😄

wraith current
#

hmm. oh yeah i guess not.

lone ferry
#

But it looks like there are other problems with the code too, such as missing braces.

#

You'll need to share your entire code, @dapper swan

wraith current
#

yeah, that code doesn't look like it was actually supposed to even run. Trying to read a float from the serial is not a basic task for a beginner arduino course.

#

@dapper swan

lone ferry
#

Well, there is Serial.parseFloat() that's supposed to do this. Maybe this API changed over time and that code is for an older version, or perhaps even their own Serial class?

wraith current
#

I don't think Serial.read was every supposed to have the receiving variable passed into it as a parameter though 😉

lone ferry
#

Probably not, but you could rewrite parseFloat as read(float&).

wraith current
#

@dapper swan so that is your assignment to find the faults in that code snippet ?

dapper swan
#

yeah i changed it a bit

#

no errors now but the monitor doesn't display what they want, i think

lone ferry
#

Keep in mind that we don't know what you're actually supposed to do 😉

wraith current
#

well, it's kind of a difficult first assignment for a beginner arduino class but you are in uni so they've got to challenge the kids who already know some things.

#

@dapper swan

#

but you'll def. get some points if you fix the error on line 6. read this article to learn about it https://en.wikipedia.org/wiki/Zero-based_numbering#:~:text=Zero-based numbering is a,mathematical or non-programming circumstances.

Zero-based numbering is a way of numbering in which the initial element of a sequence is assigned the index 0, rather than the index 1 as is typical in everyday non-mathematical or non-programming circumstances. Under zero-based numbering, the initial element is sometimes term...

dapper swan
#

it's a long way, these professors assume we have a basis of programming knowledge, but truth be told, I haven't studied programming in over 14 years

#

we have a free week next week, so i can spend it trying to understand arduino better

blissful meadow
#

// defines pins numbers
const int trigPin = 4;
const int echoPin = 2;
// defines variables
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication
}
void loop() {
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
}

#

I need help

#

my code is showing "distance 0"

#

I'm not sure if my code is bad or my sensor is shot

#

(it gave some smoke)

woven mica
#

for simplicity make duration and distance floats

blissful meadow
#

okay

#

but is the code good?

#

is it okay if you check it

#

so i can see if my sensor is shot

woven mica
#

Then try thecode with floats

vivid rock
#

@blissful meadow are you using one of the common HC-sr04 sensors? which arduino are you using?

blissful meadow
#

I'm using HC-sr04 and ardoino Uno

#

r3

#

@vivid rock

woven mica
#

@blissful meadow your code will not work if you dont make the variables floats

blissful meadow
#

so where should i put it

woven mica
#
float duration;
float distance;

place it instead of the top lines

blissful meadow
#

where on the top lines?

woven mica
#

long duration ....

blissful meadow
#

?

woven mica
#

lines 5 and 6 in code you posted

keen lichen
#

Hello. I need some help with PROGMEM and classes.

In my sketch:

I have TestClass.h

#include <avr\pgmspace.h>
#include <stdint.h>

class TestClass{
public:
    TestClass(const uint8_t arraySize, const uint8_t ***valueArray);
    uint8_t GetSize();
    uint8_t GetValueAt(int y, int x, int b);
private:
    const uint8_t arrSize;
    const uint8_t valArray[][3][2] PROGMEM;
};

I also have TestClass.cpp

#include "TestClass.h"

TestClass::TestClass(const uint8_t arraySize, const uint8_t ***valueArray)
 : arrSize{arraySize},
   valArray{valueArray}{}

uint8_t TestClass::GetSize(){ return arrSize; }

uint8_t TestClass::GetValue(int y, int x, int b){
    return pgm_read_byte(*(*(valArr+y)+x)+b)
}

And my sketch.ino

#include <TestClass.h>

const uint8_t testValues[][3][2] PROGMEM = 
{
  {{100,2},{5,0},{10,4}},
  {{1,20},{35,128},{10,5}},
  {{5,10},{1,5},{12,5}},
  {{20,1},{151,59},{12,5}}
};

const TestClass testmember(4,(uint8_t***)testValues);

void setup(){
  Serial.begin(9600);
  Serial.println(pgm_read_byte(*(*(testValues+2)+1)+0)); //This line prints testValues[2][1][0], which is 1

  //I want this part to print 
  /*
  0- {100 2 }{5 0 }{10 4 }
  1- {1 20 }{35 128 }{10 5 }
  2- {5 10 }{1 5 }{12 5 }
  3- {20 1 }{151 59 }{12 5 }
  */
  //It prints seemingly random values instead
  //ex:
  /*
  0- {148 238 }{137 255 }{137 96 }
  1- {131 232 }{137 249 }{137 128 }
  2- {129 131 }{112 128 }{100 128 }
  3- {131 159 }{191 129 }{224 144 }
   */
  uint8_t aSize = testmember.GetSizer();
  for(int i = 0 ; i < aSize ; i++){
    Serial.print(i);
    Serial.print("- ");
    for(int j = 0 ; j < 3 ; j++){
      Serial.print("{");
      for(int k = 0 ; k < 2 ; k++){
        Serial.print(testmember.GetValue(i,j,k));
        Serial.print(" ");
      }
      Serial.print("}");
    }
    Serial.println();
  }
}
#

Thanks for your time & any help would be greatly appreciated

woven mica
#

@keen lichen I think you should use arrsize(arraySize) and same with valarray in Testclass

north stream
#

Your three dimensional array is going to be problematic, as you have to define (and act on) RAM vs PROGMEM for each of the indirections.

#

For PROGMEM stuff, you're generally better off using 1-dimensional arrays so you can avoid those problems

keen lichen
#

so if I were to approach this with a 1d progmem array it would work?

north stream
#

I think so. You'd change your uint8_t *** pointer to a pointer to PROGMEM uint8_t * or somesuch, and your read line would be something like ```arduino
pgm_read_byte(((i * NCOLS) + j) * NROWS) + k)

keen lichen
#

Thank you very much. I’ll try doing the same thing with 1 dimensional arrays when I get back to my pc.

keen lichen
#

I have changed
TestClass.h to

#include <avr\pgmspace.h>
#include <stdint.h>

class TestClass{
public:
    TestClass(const uint8_t arraySize, const uint8_t *valueArray);
    uint8_t GetSize();
    uint8_t GetValueAt(int y, int x, int b);
private:
    const uint8_t arrSize;
    const uint8_t valArray[] PROGMEM;
};

And TestClass.cpp to

#include "TestClass.h"

TestClass::TestClass(const uint8_t arraySize, const uint8_t *valueArray)
 : aSize{arraySize},
   valArray{valueArray}{}

uint8_t TestClass::GetSize(){ 
    return aSize;
}

uint8_t TestClass::GetValue(int y, int x, int b){ 
    return pgm_read_byte(valArray+((y*3)+x)*2+b);
}

and my sketch.ino to

#include "TestClass.h"

const uint8_t testValues[] PROGMEM = 
{
  100,2,    5,  0,      10,4,
  1,  20,   35, 128,    10,5,
  5,  10,   1,  5,      12,5,
  20, 1,    151,59,     12,5
};

const TestClass testmem(4,(uint8_t*)testValues);

void setup() {
  Serial.begin(9600);
  uint8_t aSize = testmem.GetSize();
  int x = 2, y = 1, z= 0;
  Serial.println(pgm_read_byte( testValues+((x*3)+y)*2+z ));
  Serial.print("Size of array is: "); Serial.println(aSize);
  for (int i = 0; i < aSize; i++){
    Serial.print(i+1);
    Serial.print("- ");
    for (int j = 0 ; j < 3 ; j++){
      Serial.print("{");
      for (int k = 0 ; k < 2 ; k++){
        Serial.print(testmem.GetValue(i,j,k)); Serial.print(" ");
      }
      Serial.print("}");
    }
    Serial.println();
  }
}
#

I can get every value I want using pgm_read_byte( testValues+((i1*3)+i2)*2 + i3)

but doing testmem.GetValue(i1,i2,i3) still seems to return random values.

north stream
#

I'm guessing valArray isn't being set correctly

#

I would expect something like arduino valArray = valueArray; in the class constructor, I'm not sure what valArray{valueArray}{} is supposed to do

#

You could also print out the values of testValues and valArray to see if they match

keen lichen
#

To be honest I don't know c++ that well to know what valArray{valueArray}{} does

however doing valArray = valueArray; gave an error :
error: assignment of read-only member

I saw the solution above used by anoter arduino library

#

You are right though, it might not actually be saving the values in progmem that way

#

I'll research a bit. brb!

#

Oops. I did a newbie mistake.

So, the solution of class_variable_name{parameter_variable_name}, is correct for basic variable types, however for arrays/structs/classes/anything that isn't a basic type needs to be written like: class_variable_name(parameter_variable_name),

#

Welp, thanks for all the help!
I didn't even think of the issue being so simple.

north stream
#

Thanks for sharing what you found, I learned something!

quaint spire
silver stirrup
quaint spire
#

Perfect! @silver stirrup thank you

keen lichen
#

I don’t actually know any good guides/lessons that teach arduino but I’d go with the examples on arduino’s official site.

#

I just got an arduino about a week ago and here is how my learning experience was like:

Day 1: use 5V and GND to turn on a led on a breadboard

Add a button to control the led

Try the flickering led example(and read the code)

Try the analog read example (and read the code)

Try connecting a 7 segment display

Accidentally destroy the 7 segment display because i didn’t add any resistors in between +5V to GND

Day 2: feel sad because you already destroyed one of the components, but hey... the arduino itself still works so it’s ok... and order some more parts to experiment with

Try some of the other examples

Learn about resistors, transistors, capacitors, other components

Day3: make simple circuits, try potentiometers, etc.

Check the arduino reference pages. The programming referece page is really easy to understand.

Day 4: more components arrive.

Try the piezo buzzer! It needs ~100 ohms of resistance. I wire 3 330 ohm resistors in parallel to get ~110 ohms It works, cool!

Play some tunes on it.

Use the new 7 segment you just ordered... make a counter. Make it go up, make it go down

Combine the analog read example with 7 segment to display the readings on 7 segment instead of through serial!

Day 5: try to get a nokia screen working with your arduino. It works! Wow. Draw images on it or something.

Add some buttons to it and make a simple game!

Start writing a library to test your knowledge/skills

It’s now day 8 for me and i’m still working on a library.

stuck coral
#

Yeah, there is a lot to learn to be proficient, more than five days. Dont be bummed, none of us were born knowing how to do this either, and it takes a long time. I spend every day working with embedded systems, some libraries take multiple full time days to get it done and validated. You are working not just with low level systems programming languages, but also within a constrained environment, and with the hardware directly, hardware is hard, but rewarding. In fact, its amazing you went through all of that in a few days, shows how the Arduino framework allows people to jump right in without hitting the learning curve as hard as if you were just left with a compiler.

keen lichen
#

Indeed. There is a lot more to learn.

Arduino is designed and documented so incredibly well, that it allows people to start building/wiring whatever they want right away and learn along the way.

I expected weeks, maybe months of reading manuals, data sheets and visiting countless forums to even build the simplest of things. I was and still am very happy that it isn’t that way. Learning as you go is much more fun. In fact, I believe learning and being able to experience your progress along with the mistakes you make, make a better teacher than just reading tons of documents.

pallid fiber
#

Hello! I am glad to join this community!
I am working on a project about bluetooth connectivity. The target is to extract data from a certain hospital device and broadcast BLE signal.
I have an ESP32 with me and i can probably set up the BLE service without issue. The issue is the extract data bit.
I am given 2 options: using the LAN port or the USB port.
Let's focus on the USB first (I will be using Arduino Mini USB Host). I currently have a SDK in .dll format as well as example code on how to transmit data through USB to Window OS. But for ESP32 I probably need to write up my own USB driver/interface. How difficult is it?
A second problem is that I don't have a clear idea of what exactly I need to write a driver/interface. Does anyone have any example? Thanks in advance!
(Not sure if this is related to Arduino. But since ESP32 can use the Arduino IDE, I assume they are similar? If not please kindly redirect me. Thanks!)

north stream
#

Presumably there's a driver available for ESP32 already.

vivid rock
#

I know that there is a TinyUSB library that can be used to turn arduino-like board into usb HID, mass storage, and more. Maybe it already has the drivers you need

#

it doesn't support esp32, but it supprts nRF52840, which also has bluetooth

#

actually, it supports esp32-s2

formal onyx
#

Hello, I've got an ESP32 working with a PCA9685, and I want to add an LCD character display with an I2C controller attached. Is there anything extra I have to do to use both of them at once? Just connect both of them to SCL and SDA? I notice the PCA9685 and the LCD display have 'I2C address' jumpers, do I need to mess with those?

vivid rock
#

check in documentation what is the default i2c address for each of them. if they are different (which is almost certainly the case), then you do not have to do anything at all

formal onyx
#

Oh ok, great. I'll give it a go, thank you

vivid rock
#

just make sure you only have one set of pull-up resistors on sda and scl lines, not two

formal onyx
#

Hm I don't currently have any, didnt even know I needed one of those, the PCA9685 is working fine though, suppose there is one built into my PCA9685?

vivid rock
#

yeah, if you are using adafruit breakout, itvsays

#

"has weak pull up to VCC"

#

pullups are required for i2c

hollow flint
#

Would love some suggestions of "best MQTT" library for arduino with an ESP32 unit

#

TIA

#

ESPMQTT isn't compiling :/

#
/Users/foo/Documents/Arduino/libraries/EspMQTTClient/src/EspMQTTClient.cpp:272:13: error: 'class EspClass' has no member named 'reset'
         ESP.reset();```
             ^
#

well that's annoying. The latest version 1.10 has that bug. 1.08 seems to work.

woven wedge
#

Hmm apparently the Teensy 4.0 comes with a packaging which says "assembled in USA", wondering about the Teensy 3.0. PJRC is a USA company but all their listings online tend to say "Country of manufacture: Unknown"

#

Actually all the ebay listings for ATmega32U4 boards are either made in china or unknown

vivid rock
#

adafruit makes their boards right here in NYC. But they don't sell them on ebay.

pallid fiber
#

@north stream Unfortunately my device use an interface that is vendor specific, and hence there is not any existing library.
Suppose I got a COM Port Interface document with me.
With that I can write a python code to send USB request command to my usb device.
"""
import time
import usb.core
import usb.util

VID = 0x10c4
PID = 0xea60

device = usb.core.find(idVendor=VID, idProduct=PID)
response = device.ctrl_tranfer(reqType, bReq, wVal, wIndex, data)
"""
Do you know the equivalent in C++ using Arduino USB Host Shield Library (or any other library)?

#

Is it something like this?

rcode = Usb.getDevDescr( addr, 0, 0x12, ( char *)&buf );

or something like this?

ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, nbytes, dataptr, NULL)

(Sorry if this is confusing. Please let me know if I am being too vague here.)

quaint spire
#

I just got an arduino about a week ago and here is how my learning experience was like:
@keen lichen I did my skip-the-resistors phase with a very expensive electronic lab my step dad bought me in middle school. 😅 I guess this Hunt the Wumpus kit is something I should have got day four, not day 0. I'll catch up! I have the time on my hands for now.

keen lichen
#

@quaint spire
At least we are both learning.

quaint spire
reef ravine
#

@keen lichen @quaint spire I'd say you two are fast learners and thanks for documenting your journeys, it'll help others to shy to post. (Coffee is wonderful for coding, not so much for surface mount soldering 🙂 )

quaint spire
#

@reef ravine flattery will get you everywhere. I feel like the hardest part was knowing what wont ruin everything. If I knew I could just put power to the Metro, I might have figured a lot of the other stuff out, but I didn't want to ruin it. I'm on a schedule. I got the POV kit working Saturday, running a new image yesterday, Wumpus is working as of today, tomorrow I'm replacing microswitches on my trackball mouse and I'm hoping to be bored with everything by the time the new Adabox shows up.

reef ravine
#

Very cool, POV is on my list of "one day". It's amazing what can be done with a few dollars of hardware these days. I got back into this hobby a few years ago, after arduino came out. In 1975 a 4K memory board was $100, now my local Microcenter gives out 32GB thumbdrives for free...

stray sierra
#

I need help with platformio

#

anyone can help?

vivid rock
#

(Coffee is wonderful for coding, not so much for surface mount soldering 🙂 )
@reef ravine hmm... never tried to surface mount coffee before. That's an interesting idea.

reef ravine
#

@vivid rock lol, yeah in that sense coffee and PCB's definitely don't mix

hasty bay
#

I was having a hard time connecting two DC motors through the Spark Fun Qwicc motor controller to the Arduino MKR1010? Could someone help with that?

vivid rock
#

@hasty bay can you be more specific? how is everything connected, what code you use, what problems are you having?

last sphinx
#

I'm having trouble getting my SD card to initialize using the adafruit microsd breakout board with the cardinfo example code, could anyone help me figure out why?

#

I have the connections like this right now:
Connect the 5V pin to the 5V pin on the Arduino
Connect the GND pin to the GND pin on the Arduino
Connect CLK to pin 13
Connect DO to pin 12
Connect DI to pin 11
Connect CS to pin 10

#

I'm also using a nano 33 BLE, but I have tried using a UNO for troubleshooting, as well as a new SD card and rewired the circuit

north stream
#

What kind of card? What error message?

last sphinx
quartz furnace
last sphinx
#

I can post a picture of the circuit as well if that'd help

quartz furnace
#

In the details it says “Go to the beginning of the sketch and make sure that the chipSelect line is correct, for this wiring we're using digital pin 10 so change it to 10!” Just checking if that could be it

last sphinx
#

I changed it to 10 already

quartz furnace
#

Cool

last sphinx
#

I should mention that I ran the card info last night and it was working

#

That's why I'm even more confused

hasty bay
#

Can you use openCV with arduino?

cedar mountain
#

It's really targeted at systems that have a full OS.

stuck coral
#

You can implement some of the functions used in opencv on the arduino though

warm beacon
#

Hey all, I'm getting back into Feather and Arduino after some time away. I'm using a Feather Adalogger M0 with the Neopixel Friend Feather for the 5V shifting. My laptop is plugged into the M0 and is providing power. The power for the WS2811s is separate, though the grounds are tied together at the WS2811 strand start. Anyway, my issue is that Arduino IDE often fails to put the M0 into debug mode for code download. So I have to push the button and manually specify the alternate serial port. Is there any easy way to make this work all the time? It's so nice when it works.

keen lichen
#

Here I am, once again, asking for help.

I wanted to ask if it was possible to have an instance of a class in another file... (a .c file for example)

Here's what we can do and how we can do it:

If I have a file called data.c
in the root folder of my project containing:

#include <avr/pgmspace.h>

const uint8_t data_arr[] = {0x01, 0x02, 0x03};

int arr_size = sizeof(data_arr); //this works since sizeof(uint8_t) is 1
                                 //generally it's better to do sizeof(data_arr)/sizeof(data_arr[0])

and if my project.ino file contains:

extern const uint8_t data_arr[];
extern int arr_size;

void setup(){
  Serial.begin(9600);
  for (int i = 0 ; i < arr_size; i++){
    Serial.println(pgm_read_byte(data_arr+i));
  }
}

I get the expected output:

1
2
3

.

#

however what I want to do is something more like this:

data.c:

#include <avr/pgmspace.h>

#include "TestClass.h"

const uint8_t data_arr[] = {0x01, 0x02, 0x03};

const TestClass dataMember(3,data_arr);
#

^^^ I tried the code above and I get a ton of errors...
Here are some of the errors:

 class SPISettings {

^^^ arduino somehow not being able to include it's own libraries?

#
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\libraries\SPI\src/SPI.h:72:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 class SPISettings {

^^^ continuation of similar errors (there are lots of errors about both arduino's & my headers, not pasting the rest)

finally near the end I have these errors regarding my includes...

4by5fnt.c:190:7: error: unknown type name 'PGE_Mini_Font'
 const PGE_Mini_Font font4by5fnt(0x04,0x05,0x81,(uint8_t *)data4by5fnt);
       ^~~~~~~~~~~~~
4by5fnt.c:190:33: error: expected declaration specifiers or '...' before numeric constant
 const PGE_Mini_Font font4by5fnt(0x04,0x05,0x81,(uint8_t *)data4by5fnt);
                                 ^~~~
4by5fnt.c:190:38: error: expected declaration specifiers or '...' before numeric constant
 const PGE_Mini_Font font4by5fnt(0x04,0x05,0x81,(uint8_t *)data4by5fnt);
                                      ^~~~
4by5fnt.c:190:43: error: expected declaration specifiers or '...' before numeric constant
 const PGE_Mini_Font font4by5fnt(0x04,0x05,0x81,(uint8_t *)data4by5fnt);
                                           ^~~~
4by5fnt.c:190:48: error: expected declaration specifiers or '...' before '(' token
 const PGE_Mini_Font font4by5fnt(0x04,0x05,0x81,(uint8_t *)data4by5fnt);
                                                ^
exit status 1
unknown type name 'PGE_Mini_Font'
#

Weird thing is, if I have #include "MyClass.h" in the .ino file, there are no errors. and I can actually use the functions in the class.
However, when I have the #include "MyClass.h" in the .c file, there are all sorts of errors, doesn't compile.
If I get rid of #include "MyClass.h in the .c file, then it doesn't compile because it doesn't know the type MyClass.

north stream
#

The .c file may need some explicit #include statements that the .ino file gets automatically

keen lichen
#

I have been thinking that as well, I tried my luck with Arduino.h , stdint.h (for uint8_t)
and a few more

#

I'm still experimenting with combinations

#

I'm kinda suspicious that it's because I'm trying to create an instance of a class in compile time by forcing const...

north stream
#

There could also be some sort of #define conflict (those can be annoying)

#

Sometimes I'll chase them down by getting dumps of the postprocessed files and examining them

pulsar junco
#

would define guards help if so?

north stream
#

Probably not, usually you need to rename things to avoid conflicts, or use #undef to remove the problematic ones

pulsar junco
#

oh I see what you meant by #define conflict

keen lichen
#

alright, so...

#

idk what actually happened.
I moved the c file into another folder and tried compiling without it. It didn't compile... I went ahead and checked the headers and cpp files one by one. Didn't compile at all... I decided to pull that "turn it off and on again" trick. Closed the ide, relaunched it. It compiled.
Added one header back, it compiled.
Added all the headers, it compiled.
Added the c file. It compiled.

#

I'm kinda curious what went wrong the first time though...

pulsar junco
#

did you make offerings to the elder gods this month?

#

sometimes if you forget things like this can happen

#

they don't have a ton of power in modern times, but they have some

keen lichen
#

Ah, that must be it.

pulsar junco
#

partial to macaroons I've found

keen lichen
#

Ah now I'm having another weird issue. but it's probably got something to do with my spagettified code.

pine bramble
#

Hey guys can you recommend me good PID library for arduino (or avr in general) ?

sweet sleet
#

the LED from the arduino nano turns off when i plug in the power to my 5v displays

lone ferry
#

If your Arduino turns off when you plug something in, you're probably plugging it into the wrong place or the thing you're plugging tries to use too much current.

sweet sleet
#

yes i think it was the wrong place

#

hmmm serial monitor is printing this in a loop

#

pP�@pP�@pP�@pP�@pP�@pP�@pP�@pP�@pP�@pP�@pP@pP@pP@pP@pP@pP@pP@pP@pP

#

i'm on baud 9600

woven mica
#

You must connect the nanos ground to the displays

sweet sleet
#

😮

#

okay

#

i'll do that with a breadboard

#

still nothing

woven mica
#

What does the red light on the last display mean

sweet sleet
#

this is what the guy who made it said:

#

There are three leds (I only soldered one on yours, iirc I think the one that indicates the module is processing a serial command). I cant remember off the top of my head what the other two do (probably debugging related I'm sure).

#

I have the D1 tx on the nano connected to rx of the 3 boards

woven mica
#

The problem seems to be in the code

sweet sleet
#

but i feel it should not make a difference

#

also in the video, he does not seem to ground the displays RX

woven mica
sweet sleet
#

ok i will try it out

woven mica
#

There is no documentation on how addresses are assigned to the displays

sweet sleet
#

this is the driver on the displays

woven mica
#

Yes, but you need to know the address that is assigned to every display, it is not in the code

sweet sleet
#

when i upload the code it should in theory start driving the displays correct?

woven mica
#

yes, it should drive them

sweet sleet
#

i shouldnt have to disconnect the power or the nano

woven mica
#

no, dont disconnect it

sweet sleet
#

it says done uploading but nothing is happening

woven mica
#

Display does not do anything?

sweet sleet
#

correct

woven mica
keen lichen
#

Yay, I got most of the stuff working!

sweet sleet
#

hmmmm still nothing

#

i see you added mode(0); which is a good observation

woven mica
sweet sleet
#

how long should this take haha

#

i uploaded the code and ran it and still nothing :/

keen lichen
#

Does anyone know if it's possible to control piezo speakers volume while still using tone() function?
I think the tone function just does digitalWrite()...

#

hm

woven mica
sweet sleet
#

thank you for your help @woven mica

#

i'll give it a shot.

#

still nothing

woven mica
#

What if you disconnect two of the displays?

sweet sleet
#

still nothing...

#

when i unplug the power and plug it back in while holding the button on the back of the display the display will count up from 00 to 99

#

but that is because the code is loaded onto the the actual display

#

but that shows that the 12v is working fine

#

it also, when i restart and plug back in, will clear the display

woven mica
#

Is the TX of nano connected to RX of the display?

woven mica
#

This is really strange 🤔

sweet sleet
#

I wonder what the issue could be since I've tried different controllers

#

maybe it's the serial line on the modules

#

hey!!! i plugged it into one display and it types out weird stuff

keen lichen
#

Does the serial pin work though?

#

Oh nevermind it does then, maybe?

sweet sleet
#

it's not really doing what the code says

#

omfg

#

guys

#

it's working

keen lichen
#

Well, i’m an arduino noob.

sweet sleet
#

38

#

39

#

40

#

41

#

42

keen lichen
#

Oh hey, cool

sweet sleet
#

YES!!

#

idk why it's doing these numbers though?

#

like why did it start at 38

keen lichen
#

when i unplug the power and plug it back in while holding the button on the back of the display the display will count up from 00 to 99
@sweet sleet

#

Is it doing this?

sweet sleet
#

no but i'm running another code

#

77

#

78

keen lichen
#

but that is because the code is loaded onto the the actual display
@sweet sleet maybe because of this

sweet sleet
#

i unplugged at 79

#

i'll now plug back in

#

it clears

#

then starts at 86

#

it might be the battery retaining the number!

woven mica
#

What code do you use?

keen lichen
#

It might be that. Or maybe the value isn’t initialised before counting.

sweet sleet
#

i plugged it in only to display numbered '0'

#

so it's only 1 display

keen lichen
#

What! Pastebin got banned in my country... when.. why.. how?

sweet sleet
#

i tried using the same code on display numbered '2' and it doesnt work

#

OH i know why it's continuing.

#

i only unplugged and replugged the power. NOT the nano

#

oh no... display 3 i can hear the toggling of the coils but it won't change

#

no. it's buggy.

keen lichen
#

You don’t need to have
while(1) on void loop() by the way, that’s what the loop function is for.

sweet sleet
#

good point. i didn't write the code

#

display 0 is the only one that works

#

the same code won't work on the d1

keen lichen
#

Is this part trying to separate a long or int (temp) into 6 digits?

      digits[5]=temp/100000;
      temp=temp%100000;
      digits[4]=temp/10000;
      temp=temp%10000;
      digits[3]=temp/1000;
      temp=temp%1000;
      digits[2]=temp/100;
      temp=temp%100;
      digits[1]=temp/10;
      temp=temp%10;
      digits[0]=temp;

If so, that’s not the right way to do it.
This however would split the number into digits.

currentDigit = 0;
while (temp>0 || currentDigit <6){
    digits[currentDigit] = temp%10;
    currentDigit++;
    temp /= 10;
}
sweet sleet
#

Yes agree it’s cleaner but now that nothing works i just keep it as is since it works in theory

keen lichen
#

Hm. Maybe you need to clear screen every time you want to write new data?

#

I’m not entirely sure but that might be a possibility

#

Or, if the display doesn’t require serial(by that i mean specific baud rate), you could try sending data through mosi? (Though you may need to try different clock divisions for SPI for that to work, or it might not work at all.)

#

@sweet sleet

sweet sleet
woven mica
#

The display is controlled through serial

sweet sleet
#

Shoot

#

Its no longer working

#

Okay it works again

#

I think there’s not enough power to drive more than one display??

#

Hmmm

#

For the other displays it just displays 0

#

It could take some timr since display 0 is the first 2 digits???

woven mica
#

yes

sweet sleet
north stream
#

I wonder if you have been having power issues all along

sweet sleet
#

Omg!!!!!

pulsar junco
#

ayy!

sweet sleet
#

I think it works!!!!!!

#

Omg!!!!

#

Thank you guys

#

I’m so so happy

north stream
#

I'd put up a confetti reaction but I'm on my phone. Congratulation, well done!

keen lichen
#

Well done. What fixed it though?

wraith current
#

@sweet sleet yeah what fixed it ? was it power issue ?

sweet sleet
#

hey guys! sorry i was muted for tagging a bunch of people to thank them.

#

it's possible that it was not working with the original board because I didn't have it grounded

#

or i think it's just the original D1 board would not work.

#

omg it works on my nodemcu with 3.3v!!!

#

well i'm using the 5v actually from the separate controller

sweet sleet
#

OH how do you change the tx line so it's not connected to the serial output??

#

esp 8266 nodemcu

#

like how do i programmatically change the tx on nodemcu

sweet sleet
#

Software serial

uneven nova
#

excuse me if this is an insanely stupid question, but i'm not sure how to solve my problem. I have 4 buttons, and i need to store the input sequence in an array to compare it with another.

#
int i = 0;
  while (i<=n){
    
    if(digitalRead(7)==HIGH){
      inputSequence[i] = 13;
      i++;
      }
    
    if(digitalRead(6)==HIGH){
      inputSequence[i] = 12;
      i++;
      }
    
    if(digitalRead(5)==HIGH){
      inputSequence[i] = 11;
      i++;
      }
    
    if(digitalRead(4)==HIGH){
      inputSequence[i] = 10;
      i++;
      }
    delay(10);
  }
#

Here's the code i've put in a function. n is a global variable and inputSequence is the array i'm trying to store the sequence in. The problem is, whenever I press a button, the loop just stops

pulsar junco
#

assume this is within ```C++
void loop()

uneven nova
#

no, this is in a separate function

pulsar junco
#

what do you initialize n as?

#

or rather do you know the value of n when you enter the loop?

uneven nova
#

n is initially zero, but it increments every time void loop() loops

pulsar junco
#

how long is your void loop()? is it postable?

uneven nova
#

sure is

#

hold on

#
void loop()
{
  makeSeq();
  dispSeq();
  
  for(int i=0;i<=n;i++){
    Serial.println(sequence[i]);
  }
  
  inputSeq();
    
  if(n<maxBlips-1){
    n++;
  }
  else{
    n=0;
  }
  
}
#

the function in question is inputSeq()

#
int buttonState7 = 0, buttonState6 = 0, buttonState5 = 0, buttonState4 = 0;
const int maxBlips = 5; //Set the maximum number of levels here
int sequence[maxBlips];
int inputSequence[maxBlips];
int n = 0;
pulsar junco
#

is loop() the only place where n is modified?

uneven nova
#

yes

pulsar junco
#

I'm not seeing inputSeq() called anywhere, where is it called?

uneven nova
#

10th line in void loop()

pulsar junco
#

lol mybad

uneven nova
#

my logic, and i feel like there's an issue with this, is that the while loop will continuously loop until a button is pressed, at which point the pin number will be stored and i will increment

#

i'm also open to other approaches

keen lichen
#

Software serial

There are two methods, the simple method is to use:

shiftOut(dataPin, clkPin, bitOrder, data(byte))

bitOrder can be either MSBFIRST or LSBFIRST.

You don't have much control using shiftOut.
The clock speed of shiftOut varies but I measured it to be about 1/8th the clock speed of arduino models if you are sending only 1 byte.
If you send more bytes, the time it takes the data to be sent through shiftOut will depend on how effective your code is. (How you access data, do you modify data before sending, etc) There's also shiftIn for when you want to read data!

Then there's a header that I haven't touched yet called <SoftwareSerial.h>

you first initialize an instance of SoftwareSerial using SoftwareSerial softSerial(pinRX, pinTX) (can be any of the digital pins)
You set the baud rate & other variables if you need to...
softSerial.begin(9600)
You can then use software serial almost as if it's a hardware serial. It supports similar functions:
print, println, write, read, etc.

@sweet sleet

sweet sleet
#

❤️

#

can i power this nodemcu with a 5v line?

keen lichen
#

I don't know tbh.

sweet sleet
#

i got it working very well i didn't use a second softwareserial but I just deleted all the serial.print commands

#

i would have to ground it too if i did right

#

these wires are getting tricky

uneven nova
#

does someone have an alternate solution to my problem, or is there something wrong with my logic?

pulsar junco
#

I'm not 100% sure why it's not working, it seems sound? But are you intending for inputSequence to be overwritten every time?

sweet sleet
#

Are there good series cables i should use to organize these

#

I also have two power sources

uneven nova
#

yes inputSequence is overwritten every time it's called

pulsar junco
#

just to make sure I'm not misunderstanding, what's the behavior you're actually seeing?

uneven nova
#

so i run the program, everything works smoothly until i call inputSeq()

#

where i want multiple buttons to be pressed before the program continues, i can only press once

pulsar junco
#

that makes sense for the first loop since n = 0 and i++ would make your while conditional false

#

*first call

#

hm

iron mason
#

Oh, I timer's up I can type.

#

Hello all, hope you're having a lovely day.

#

I'm looking to play around with expanding external memory with an EEPROM and I'm trying to understand how to identify chips which will work with the arduino UNO. From my research so far I believe the criteria for this involves clock speed and that we have I2C available, though I believe that's pretty much the standard. I can't say I fully understand how clock speed interaction works other than that I'm aware timing is a big deal, I just don't fully understand it (yet).

#

So, if anyone has any information about this they'd be willing to share, that would be awesome.

#

I'm just interested in figuring out what options there are. I also have to explore how addressing plays in to this since I don't really have a solid understanding of limitations on addressable space.

north stream
#

@uneven nova looks like it just zips through the loop filling up the array when the first switch is pressed

pulsar junco
#

even with the delay?

uneven nova
#

@north stream you mean the moment i press the switch it fills the array with random numbers and doesn't allow for more inputs?

#

Oh i see, it fills the entire array with the button number i pressed

#

So how would I make it wait for an input after the first press?

north stream
#

The short answer is, wait for the switch to be released again before continuing.

#

The longer answer is you should probably use either a debouncing library or a delay, so switch bounce doesn't act like several very fast presses in a row.

uneven nova
#

Well that solved it (for now)! Thanks for the help guys

pulsar junco
#

just madbodger lol

uneven nova
#

thanks for inputting lol

pulsar junco
#

i'll make sure to debounce my input next

uneven nova
#

ha nice

iron mason
#

I have a feeling that knowledge grows exponentially as you experiment with various components.

#

Just wired up a flip-flop (properly) for the first time and I feel like I gained a lot more from the process than I expected.

leaden light
#

Hii guys can anyone say witch Arduino should I purchase or which one is more beneficial

gilded swift
#

@leaden light what are you wanting to do?

warm beacon
#

Hey all, I'm getting back into Feather and Arduino after some time away. I'm using a Feather Adalogger M0 with the NeoPxl8 Feather (for the M0) for the 5V shifting. My laptop is plugged into the M0 and is providing power. The power for the WS2811s is separate, though the grounds are tied together at the WS2811 strand start. Anyway, my issue is that Arduino IDE often fails to put the M0 into debug mode for code download. So I have to push the button and manually specify the alternate serial port. Is there any easy way to make this work all the time? It's so nice when it works.

leaden light
#

@gilded swift i am a beginner so i want to do small project

gilded swift
#

Probably an Arduino nano or uno

#

Even the Adafruit Qt Py is a great starting point

leaden light
#

Ohhk ty

gilded swift
#

😄

leaden light
#

Where can i get information about adafruit qt py🤔

#

@gilded swift

gilded swift
#

Out of stock at the moment but they have more coming

leaden light
#

👍🏻, hmm

obtuse goblet
#

can someone make this make sense?

vivid rock
#

I would advise against arduino uno. It is large, slow by todays standards, and expensive. Get one of adafruit feathers or Arduino nano 33 boards. If you do not need wifi or bluetooth, nano 33 every is cheap and quite nice

#

qt py is probably the best choice price wise, it does seem like a nice little board

odd fjord
#

@obtuse goblet What are you referring to?

sweet sleet
#

how do i delay for 1 hour

#

delay(60000*60UL); ?

north stream
#

Your best bet might be to do it a minute at a time, and count intervals: ```arduino
#define MINUTE (60 * 1000) // one minute in milliseconds

static unsigned long next;
static unsigned target = 60;

void loop() {
unsigned long curtime = millis();

if (curtime > next) {
target -= 1;

if (target == 0) {
  // do your once an hour thing here
  target = 60;
}

next = curtime + MINUTE;

}

sweet sleet
#

would this work

#

const long oneSecond = 1000; // a second is a thousand milliseconds
const long oneMinute = oneSecond * 60;
const long oneHour = oneMinute * 60;

#

then..... delay(oneHour);

north stream
#

Alternatively, you could just set next to an hour in the future: ```arduino
static unsigned long next = millis() + 60 * 60 * 1000;

#

The delay() call is mostly for brief intervals, which is why I like to use millis() for longer times. A side advantage to doing it that way is that you can have the processor doing other things while it's waiting, or (if you want to get fancy), you can modify the code to have the processor sleep when it's not doing anything.

sweet sleet
#

hmmmm okay i want my loop to do a function every 30 minutes or one hour

#

excuse the foul language lol

#

this would be every 1 minute right?

#

oh there's a bracket missing

pulsar junco
#

how long are you planning on having your code run?

sweet sleet
#

forever

pulsar junco
#

you might be served by an RTC then

#

adafruit makes a breakout

sweet sleet
#

what

pulsar junco
#

real time clock

sweet sleet
#

i'm not sure how to handle that

vivid rock
pulsar junco
#

the reason is that the clock on the arduino is going to drift over time and your 30 min/60 min timer will become less and less accruate

#

accurate

sweet sleet
#

that's fine.

#

it doesn't have to be exactly 1 hour

#

+- 10 minute variance is fine

vivid rock
#

then indeed using millis() is fine

sweet sleet
#

do i need to import date time or something

north stream
#

To use an RTC, you'd probably use a library, but millis() is built-in

iron mason
#

Hey all.

sweet sleet
#

millis

#

millis() gets current time in millis?

vivid rock
#

@sweet sleet time since board restart, in milliseconds

iron mason
#

I was just experimenting with a counter/divider IC and I was having a lot of trouble getting it to operate as intended. I'd pulled a couple pins low (reset and clock hold) using 10K Ohm resistors as I'd seen done on a flip-flip IC I played with yesterday. I assumed this was standard procedure when pulling things up or down since I'm still overcoming ignorance. Turned out this was wrong and a direct path to GND was needed for correct operation.

#

I don't know how to identify when a resistor is needed, though I did read the datasheet to the best of my ability.

#

Perhaps I'm confused and the pins which I had to pull through resistors yesterday were active low, so I was pulling high through resistors... maybe that's when you need a resistor...

#

I should go review.

vivid rock
#

@sweet sleet note that millis() returns an unsigned 4-byte integer, which means its maximal value is something like 4 billion, which equals to (roughly) 45 days. So the value will overflow after 45 days

sweet sleet
#

ah okay got it.

iron mason
#

It does appear the pins on the flip flop were pulled high to inactivate them. So until I have better information I guess I'm going to assume if pulling high, go through a resistor, if going low, don't.

#

😛

sweet sleet
#

static unsigned long next = millis() + 60 * 60 * 1000;

#

how do i then enact a delay for this amount of time

#

is it the same code as above

vivid rock
#

yes

sweet sleet
#

ok

#

there was a bracket missing

#

i'm gonna step thru it now to understand it

#

Also for some reason these displays are showing the wrong value now 😔

#

Should be 4397 not 9797

iron mason
#

What's the name of that type of display?

sweet sleet
#

i'm gonna flash it and do another counting up test

#

em 7 digit display

iron mason
#

7 segment?

sweet sleet
#

yes

iron mason
#

These are mechanical or something though?

#

Mine are LED driven

sweet sleet
#

mechanical

iron mason
#

Very cool

#

I wonder if anyone makes a neon 7 segment display 🤔

sweet sleet
#

shoooooot!!! the second display is accidentally matching the first

iron mason
#

That would be pretty cyberpunk

#

I was going to ask that 😄

#

What are you building with this?

reef ravine
sweet sleet
#

displays the total number of miles i've run

iron mason
#

@reef ravine Read my mind

sweet sleet
#

any idea how i'd go about fixing the address on the middle 2 digits?

#

oops wrong video

reef ravine
#

they can be had more cheaply as Soviet surplus

iron mason
#

I just realized those "how to make acrylic enclosures" videos I watched for no purpose years ago suddenly are very interesting....

vivid rock
#

@reef ravine at over 1000 Euro per clock, this is pricey

sweet sleet
#

i tried making an acrylic enclosure on this

iron mason
#

I can finally build that flux capacitor

reef ravine
#

but sooo beautiful 🙂 NOS tubes can be had much cheaper

iron mason
#

Yeah a bit out of my technical range for the moment but I will come back to it 🙂

vivid rock
#

@reef ravine what is NOS?

iron mason
#

Atm I'm trying to comprehend when to use a resistor for pull up/down 😛

reef ravine
#

New Old Stock, tubes in boxes from the 1970's

sweet sleet
#

😦 do i have to flash the firmware on the PICs to fix the addresses?

#

it seems it got messed up

iron mason
#

Oh good lord I think there was just some gunk on the resistor I was using -_-

#

There's no problem with pulling low via resistor which is what I thought initially

sweet sleet
#

it seems the middle two digits are copying the rightmost two digits (the rightmost 2 digits are fine)
It seems the addresses may have changed for some reason! Is there a way to fix this?

iron mason
#

Sure you're not just sending the wrong bits or something?

#

I assume you're shifting out portions of a 4 byte value to each display

sweet sleet
#

positive it's the correct bits

#

it was working earlier

#

:/

iron mason
#

Sorry m8 I just don't know anything about how your signal is passed or what addressing you're doing

sweet sleet
#

no worries

#

i'll try to figure it out

#

here's the driver on the displays fyi

#

and rough sample code

sweet sleet
#

could it be that the address somehow changed on one of these boards?

pulsar junco
#

do you know how the address is set?

sweet sleet
#

honestly no i dont.

pulsar junco
#

some designs have jumpers/pads that you can connect to a signal (gnd or supply sometimes) to change the address

sweet sleet
#

i will ask

#

i think it's possible that i accidentally changed it when i was touching and moving the thing

#

i was trying to put the whole thing in an enclosure

#

Programming the address is currently only possible through using an icsp programmer to flasht the eeprom

#

uh oh.

#

this is way too advanced for me.

pulsar junco
#

did you make a change to the code that writes to the displays?

sweet sleet
#

no

pulsar junco
#

hm

sweet sleet
#

suddenly one of the modules is responding as if it was another address

pliant kettle
#

Hey guys, I just got a playground express but it doesn't appear to show up on Windows 10. I tried the troubleshooting options but I haven't had any luck. It does appear as a "other device" though.

#

I plugged in the Trinket M0 I bought as well and that seemed to be loaded fine.

#

hmm I'm not sure how to resolve the windows setup with the Playground Express. If anyone has any tips that would be appreciated!

north stream
#

If it was responding to the correct address before, and it's not responding to the correct address now and you didn't reflash it through ICSP, I suspect the problem is something else

pliant kettle
#

I have tried 3 different machines now. All have the same results.

reef ravine
#

Are you using the same usb cable on the trinket and the CPE?

pliant kettle
#

no, I'll try the different cables now.

reef ravine
#

some are "power only"

pliant kettle
#

both are the same brand. I bought 2x when I got the boards.

#

using the other cable didn't work.

reef ravine
#

worth a shot, power is there as you get BLE...

pliant kettle
#

When double tap the reset button the playground goes red. Is that correct?

reef ravine
#

double tap should cause something to happen, does BOOTPY or similar now appear?

#

a CPE is next on my list, they were out of stock when last i checked

pliant kettle
#

nah, I do hear the windows usb connect and reconnect sound though. So it sounds like it's doing something, but each time it reconnects I never see it as a drive in explorer.

reef ravine
#

take a look at Device Manager, does an unknown device come and go?

pliant kettle
#

when connecting the trinket I do see the USB safely eject pop up in my tray though. With the CPE it doesn't appear.

#

nah nothing unknown in device manager, and nothing suggesting it needs a driver update

reef ravine
#

does it show up (erroneously) under Ports(COM & LPT)?

pliant kettle
#

yep

#

it does

pliant kettle
#

hmm mine is listed like so

#

ill try the steps though

#

thanks for your help so far

reef ravine
#

i don't think that's the same issue

#

but it comes and goes with the CPE?

pliant kettle
#

i tried anyway

#

yup

#

unplugging/replugging sees the COM6 entry disappear and reappear

#

uninstalling device and then resetting the CPE didn't do anything either. It was just relisted under ports the same.

reef ravine
pliant kettle
#

okay thanks

tribal jewel
#

Hi,
I have a few of the Infineon TLE493D sensors which I am trying to connect in an array through a basic Arduino Uno. Since the sensors, all have the same addresses 0x35, I attached them to the Adafruit multiplexer TCA9548A to send me flux changes data periodically.
The primary issue I am facing is, when I run my code, after several readings, it bricks.
I have been troubleshooting at a hardware stage and have realized that changing from one sensor to another, causes this issue.
I have a logic level converter attached to my system for safety precautions and have tried putting one sensor on the I2C bus and the other on the I2C through the Multiplexer to check the issue. The problem still persists. Please note the sensors work okay on their own as it is.
Can someone please help me with this situation? I am trying to attach multiple of the same sensors.

north stream
#

I wonder if the problem is on the sensor end or on the Arduino end (like in the sensor driver)

#

Also, are you using interrupts?

dark shard
#

Hello, may I ask a question about the BNO055?

vivid rock
#

@dark shard yes, you may

dark shard
#

Thank you kindly, give me a moment to organize my thoughts concisely.

#

@vivid rock

Okay, so I'm trying to use the BNO055 for a Madgwick filter. I think I'm all good on the quaternions and matrix multiplication side of it but I want to change the configuration into the operation mode config so I can change the accelerometer range from -4/4g to -8/8g. I'm just REALLY fuzzy on the procedure and syntax I need to do for that.

I have the Adafruit_BNO055.h library included and have made an IMU object. It is connected using the I2C bus to a nano. I'm confused on how I go about telling it to change the configuration. I found a tutorial that says to use Wire.beginTransmission() where the argument is the device address in hex and then do Wire.write() where the argument is the register address and then do Wire.write again with the new data I want put in but those are in hex and the datasheet from Bosch has it in binary.

#

Also the binary from the datasheet is 9 bits long and the tutorial says that Wire can only send 8 bits at a time.

#

The library for the BNO055 uses hex addresses though.

#

But when I try to access the class with:
Adafruit_BNO055::() I'm unsure if I should have an argument in there and it says I can't access the class when I try to verify.

#

So yes, any advice you have would be greatly appreciated and thank you in advance.

vivid rock
#

OK. First of all, why BN0055? Main selling point of this chip is that it already has sensor fusion in the chip - if you are using madgwick on the microcontroller, than you don't need that, so it sounds like a waste

#

why not use the fusion which is already on the chip then?

#

let me do a quick check of the datasheet and adafruit library

dark shard
#

Thank you for checking that.

This is my first time playing with an IMU and I found Paul Mcormic's video series from TopTechBoy on youtube. He strongly stressed using the same equipment. We also went with this one since it comes already calibrated.

I'm not using the fusion modes because my understanding is that they will give me the roll pitch and yaw but I also want the controller to run a Kalman filter for trajectory aswell. The madgwick is for our orientation.