#help-with-arduino

1 messages · Page 90 of 1

warm matrix
#

but the faster increments and smaller delay should help. I just dont understand why it seems to go at full speed immediately, when it should be at less than half speed to start

thick stag
#

threshold unknown to me
You start at 0 to learn these things.

#

Code is easily changeable. Try things out, experiment, and adjust.

warm matrix
#

True. The first time I ran it with i=0, I saw no movement at all so I thought something was wrong. It only occurred to me later that the i value was probably too low to supply enough voltage to the motor, and needed more time to ramp up

shadow marlin
#

Also, add print statements so you can see on the serial monitor how fast you are attempting to run the motor at each point. It's debugging time.

uncut cairn
#

hey! is there any way of generating PWM output on a non PWM pin? I was just playing around with arduino and thought of this

north stream
#

You can turn the output on and off regularly. You could do this with a timer interrupt (tricky but it works) or a CPU loop (keeps the CPU from doing a lot else while you're generating the waveform)

uncut cairn
#

Actually I want to design a program where I can also change the duty cycle.. i tried with digitalWrite() but obv can also switch between high and low

#

Like I give an input with the duty cycle and get the desired wave on an oscilloscope

pliant totem
#

Guys, excuse me, for arduino, where can i get the cstring library?

north stream
#

That's doable. For low frequency, you can just use counting loops or delay() and digitalWrite(). For faster response, you can write directly to the GPIO ports.

#

Which cstring? The ctypes one, or the C++ support or something else?

pliant totem
#

the one in this code

#include <ros.h>
#include <std_msgs/String.h>
#include <std_msgs/UInt16.h>

#define BUTTON 8
#define LED 13

ros::NodeHandle node_handle;

std_msgs::String button_msg;
std_msgs::UInt16 led_msg;

void subscriberCallback(const std_msgs::UInt16& led_msg) {
  if (led_msg.data  == 1) {
    digitalWrite(LED, HIGH); 
  } else {
    digitalWrite(LED, LOW);
  }
}

ros::Publisher button_publisher("button_press", &button_msg);
ros::Subscriber<std_msgs::UInt16> led_subscriber("toggle_led", &subscriberCallback);

void setup()
{
  pinMode(LED, OUTPUT);
  pinMode(BUTTON, INPUT);
  
  node_handle.initNode();
  node_handle.advertise(button_publisher);
  node_handle.subscribe(led_subscriber);
}

void loop()
{ 
  if (digitalRead(BUTTON) == HIGH) {
    button_msg.data = "Pressed";
  } else {
    button_msg.data = "NOT pressed";
  }

  button_publisher.publish( &button_msg );
  node_handle.spinOnce();
  
  delay(100);
}
#

for ROS

#

im using ubuntu in a virtual machine if that helps too

uncut cairn
fading zenith
#

Hello everyone!

I am looking for help on my project. I want to make user friendly version of macro keyboard but dont know how to transfer the chosen sequences to arduino. I was thinking about storing the data to file like config.txt on SD card which is connected to arduino, but I dont know how to read and change it without pulling it from arduino and plugging it back. I am currently determine button function by changing it in the code it self:

      case 'A':
        Keyboard.press(KEY_LEFT_CTRL);
        Keyboard.write('c');
        Keyboard.releaseAll();
        break;```
I want to somehow determine it in config and transfer it inside this case. If someone know stuff like this, please contact me. I would really appreciate.

P.S. I am talking about Arduino Leonardo.
north stream
#

It might make sense to store the configuration in the Arduino's flash memory along with the program. If the amount of data is small, you might also be able to store it in the Arduino's EEPROM. Either might be more convenient than an external SD card.

pliant totem
#

So uhm, are there any libraries with Cstring involved?

north stream
#

I don't see any references to cstring in your code, so I'm still unsure what you're looking for.

fading zenith
north stream
#

Yes, it is. You can either bake in the values using PROGMEM, or have your code write its own values to flash (it could receive them from the host computer if you liked) like the bootloader does (it's a little intricate but possible): https://forum.arduino.cc/index.php?topic=332191.0

fading zenith
#

I need to look into this, because I am quite new in the Arduino stuff but I want to make something very practical.

thick stag
fading zenith
brazen hatch
#

Hi! New to the discord -- I am trying to make a truth detector using CPX and a bolted on TFT gizmo (https://www.adafruit.com/product/4367) hooked up to a heartbeat sensor (https://www.adafruit.com/product/1093), I have it coded in arduino and plotting the heartbeat in a little chart - but how can I get it to output text and something that says truth or ie based on a range of the heartbeat is in? Code is here: https://forums.adafruit.com/viewtopic.php?f=58&t=168463

thick stag
#

@brazen hatch I don't quite follow. Would you just do something like this? (this is fake code of course) bool is_lying = calculate_is_lying(); if(is_lying){ tft.write("Lie"); } else { tft.write("Truth"); }

brazen hatch
thick stag
#

I'd create a separate sketch just to play around with text. When that feels comfortable you can combine the two together.

floral coral
#

Hi. Does anyone have experience with the ArduinoJson library? I'm having trouble retrieving a parameter from the serialization.

This is what my json looks like

prettified

{
"command":"get"
"result":"ok"
"what":"loc"
"found":1
"entries":[
0:{
"class":"a"
"name":"KD9ICT"
"type":"l"
"time":"1610825646"
"lasttime":"1610825646"
"lat":"42.12967"
"lng":"-87.91083"
"altitude":191
"course":74
"speed":0
"symbol":"/>"
"srccall":"KD9ICT"
"dstcall":"TRPW7X"
"mice_msg":"111"
"path":"qAR,N0LSR-1"
}
]
}```

raw
```{"command":"get","result":"ok","what":"loc","found":1,"entries":[{"class":"a","name":"KD9ICT","type":"l","time":"1610825646","lasttime":"1610825646","lat":"42.12967","lng":"-87.91083","altitude":191,"course":74,"speed":0,"symbol":"\/>","srccall":"KD9ICT","dstcall":"TRPW7X","mice_msg":"111","path":"qAR,N0LSR-1"}]}```
#

I want to get "lat" and "lng" out. But I can't figure out how

#

I can find examples for pretty much every other situation, but not this one

#

I can get "command" or "result" out with a statement like

const char* result = doc["result"];

where doc is the name of the StaticJsonDocument

#

but for data within that array (entries), I'm a lost cause :[ any tips?

woeful steppe
#

Hey I just have a simple project I want to do. A rc car with a camera that you can control through bluetooth. I have an arduino uno so if I can use that it would be great thanks for the help.

stuck coral
woeful steppe
#

what do you recommend then

stuck coral
#

I recommend instead of getting a external bluetooth peripheral is to buy a nrf52 based board, which has bluetooth built in, and can be used with the arduino the same way as the uno.

woeful steppe
#

I'm new to electronics

stuck coral
#

For the camera, you have very limited options, but as long as you set your expectations right an ArduCAM will work

woeful steppe
#

alright thanks

#

do you know of any good tutorials using both?

#

the nrf52 and arducam

stuck coral
#

There are many if you do a google search, not together but luckily arduino makes it so the software for the camera on other devices will work just fine if you copy and paste it into your nrf52 sketch

woeful steppe
#

how would I be able to control and see live footage from my phone

#

would I need to download an app

stuck coral
#

You would need to either use an existing app, and implement what that expects on the nrf52 which I am unsure about, or make your own app.

#

I dont know of an app you could use out of the box

#

Technically speaking, you can use GATT for control, and L2CAP for the video stream and that will work well

woeful steppe
#

what is gatt or l2cap

stuck coral
#

So bluetooth is a series of standards, both of those are bluetooth standards. L2CAP is the transport layer so kinda like TCP on your computer which is on top of the bluetooth radio, then gatt is another standard on top of l2cap that lets you get/set values in a service. For isntance if you have a heart rate sensor, typically it will expose a heartrate GATT service which an app can get the value from

woeful steppe
#

I'm sorry but I don't understand any of this. I wish they would teach us this in school

stuck coral
#

You're good, any specific question?

woeful steppe
#

so where would I learn any of this

#

and what language would be easiest

stuck coral
#

And I would use the arduino framework if I were you, which is c++

shadow marlin
#

and also if this is going way above your head you should make something simpler first. like a line follower using just a strip of sensors that read light/dark (reflected light intensity) underneath you. there should be plenty of youtube/inventables tutorials. anyway do things in lots of small steps and you have a better chance of success. line follower -> add human control but with a simple device like a potentiometer attached to a long control wire straight to the car -> human control over wifi/bluetooth (must find tutorial to follow) -> add video stream... something like that.

thick stag
#

@woeful steppe If you're new to electronics, you might want to start with some simple projects first. Bluetooth + live streaming video + controlling an rc car might be a bit much for a first project

#

(ah I hadn't scrolled down in chat. Basically what Moinate said)

floral coral
thick stag
#

@floral coral I'm not familiar with that specific library, in javascript I'd do something like result = doc["result"]["lat"]

floral coral
#

Why [result]?

thick stag
#

Oh sorry I was part using your example part not paying attention lol one sec

#

how about doc["entries"][0]["lat"]

floral coral
thick stag
#

What's the error?

floral coral
#

It just doesn't see any data there

thick stag
#

How are you getting the data? Are you sure the data is there?

floral coral
#

I'm sure the data is there because I can do doc["command"] and get "get" from ArduinoJson

#

so something about specifying within that array is wrong and not really described anywhere in the documentation

stuck coral
#

@floral coral have you tried using the assistant?

floral coral
#

Isn't that just for specifying the size of the JsonDoc?

stuck coral
#

It also tells you how to serialize/deserialize

floral coral
#

Okay, I'll check it out again.

stuck coral
#

Then for every element in your array, you can parse the documents one at a time which is nice memory wise

floral coral
#

IT WORKED. OH MY GOD

#

thank you guys 😭 I can't believe I was missing something so obvious

#

cheers

stuck coral
#

Not the first to have the issue, should have seen arduinojson in the early days 🙄

#

At this point I have shunned json in embedded devices

thick stag
#

Hah, while chatting with you I was thinking back (not fondly) to the days of being so confused by one of my circuits. I spent 6 hours debugging, went to a meetup to get help and had it fixed in literally 10 seconds. It happens to all of us!

woeful steppe
#

alright I probably will try a simpler project

shadow tusk
woeful steppe
#

it's cause I saw the mini tank project on yt that had the live stream video and control but the parts are out of stock

#

and I am going to get a 3d printer

#

and I wanted to kinda make like the drone in rainbow six

stuck coral
#

And since I work with a lot of other developers working on high level applications, the proto file workflow is amazing

shadow tusk
#

Makes sense, and sounds reasonable

stuck coral
#

JSON is optimized for humans not for what actually uses them, which can be nice, and doesnt have much overhead in JS, but that is kinda a niche in computing outside the browser

#

Well, Im not really explaining this to you, you are probably fully aware

#

But for those lurking

#

Ive been wanting to really dig into Capt'n proto, which is similar but also has a really neat rpc method i think can save battery on my devices on top of being slightly faster

magic field
#

Bencoding is nice

stuck coral
#

Do you have an example use case outside of bittorrent?

#

Oh okay, it is general purpose, neato

strong apex
stuck coral
#

Option 2

#

Pray to god the protection circuit in your battery works

#

Some adafruit products have a pin to disable the regulator and a pullup

stuck coral
# strong apex Hardware question about the CPX. The 3.3v voltage regulator's EN is also connec...

Are you wanting to turn it on or off from a battery? If so, they do have have a JST switch which will just cut power to the device https://www.adafruit.com/product/3064 or alternatively https://www.adafruit.com/product/1863

strong apex
#

I'm looking to add a power switch. I'm familiar with the "EN" pin of the feather bluefruit. Worked really well, and was hoping this could work similarly. Sounds like no. Thanks!

dark shard
#

Hello, yalls. I'm working with a BNO055 IMU and we're trying to get it to tell us what its current mode is so that we can confirm the configuration changes that we made were done correctly. We found in the library for it a read8 function but it is private. Do any of you have insights on how we can get the board to tell us what mode it is in to confirm we change it right?

safe shell
#

you could PR a new getMode function?

dark shard
#

What do you mean by PR?

#

Probably write?

#

Like you are saying we could write a getMode function that reads the register?

#

OH I see what you mean, we're looking through the Adafruit_BNO055 library when we should probably be looking through the Wire.h Library.

leaden walrus
#

@dark shard PR = pull request. It's the general process for submitting changes you've made to an open source repo, like the BNO055 library. If you are unfamiliar with that process, you could open an issue:
https://github.com/adafruit/Adafruit_BNO055/issues
as a way to request new features.

dark shard
#

Okay, thank you.

leaden walrus
#

if you want a quick hack you could use today, just edit your local copy of Adafruit_BNO055.h and make read8 public

dark shard
#

We were thinking of that but we couldn't find it whic was disappointing.

leaden walrus
#

should be in your libraries folder

dark shard
#

That is what I figured but it isn't there. 😦

leaden walrus
#

typically that's <Sketchbook location>/libraries

#

are there any subfolder there at all?

dark shard
#

You are referring to in the Arduino IDE? Sketchbook doesn't have any tabs in it. Hmm that is weird.

leaden walrus
#

yep. you can check your Sketchbook folder location under Files->Preferences

dark shard
#

I found the library!

leaden walrus
#

cool!

dark shard
#

So it has private: before the read8, readlen, and write8 functions. I'm relatively new to this, do you think just commenting out the private: part will work or do I have to specify it as public:

leaden walrus
#

you should be able to just comment out the private: line

#

then it'd be like everything is falling under public:

dark shard
#

Okay, thank you kindly, I will try that.

leaden walrus
#

register looks readable

#

decoder ring:

dark shard
#

How would we read it? As just a

Serial.println(Adafruit_BNO055::OPR_MODE);

leaden walrus
#

call read8 on your instance

#

for example, if you created your bno with something like:

Adafruit_BNO055 bno = Adafruit_BNO055(55, 0x28);

then use:

Serial.println(bno.read8(0x3D));
dark shard
#

I think that is working. Thank you very much.

leaden walrus
#

sure. np! happy hacking 🙂

dark shard
#

Errr maybe not.

#

Okay, so I have what you put for creating the BNO and when I try the BNO.read8(0x3D)); it says that it is initializing argument 1 of 'byte Adafruit_BNO055::read8(Adafruit_BNO055::adafruit_bno055_reg_t)'

#

It looked like it worked because it gave me what I was trying to set it to 12 which is 0x0C but when I tried setting a different mode it still reads as 12.

tender wharf
#

how would I wire up two sensors that both need 5V to an arduino mega

#

would it work if I just attached another cable on the breadboard going from a common 5V source?

north stream
#

Yes, that should be fine

gilded swift
#

Is anyone familiar with writing Arduino board definitions?

vivid rock
#

Not all that familiar, but I did it once.

#

mostly by copypasting existing definitions, and then changing what needed to be changed.

north stream
#

Same here, but in Energia (an Arduino port for MSP430 chips)

gilded swift
#

Hmm

rain crypt
#

I have been working with the Adafruit MagTag under Arduino-esp32. This has worked pretty well up until I refreshed the espressif/arduino-esp32 idf-release/v4.2 branch recently. As of this last release the USB serial port no longer successfully identifies. I have validated that on the previous commit this still works. I have created an issue for this (https://github.com/espressif/arduino-esp32/issues/4728). Has anyone else encountered this problem?

ocean mango
#

I'm a beginner and I have an overly-cautious question about powering an Arduino via a 12VDC 1.0 Amp wall adapter and the Arduino's VIN & GND pins. The documentation for the Arduino says that it can handle being powered by 12V, but in the examples they always show the 12V coming through the barrel jack. Can it handle 12V coming in from the VIN & GND pins on the Arduino? I tried asking in the Arduino forums but nobody answered. The purpose of all of this is to have a high-powered LED (via a Sparkfun PicoBuck) light up whenever I want it to, and not fry the Arduino unnecessarily.

north stream
#

The barrel jack is hooked to the VIN pin via a diode: it should be fine to power the board by the VIN pin, but it doesn't have polarity protection, so be careful not to hook it up backwards.

gilded swift
#

Also done be alarmed if the regulator is hot

#

12V-5V will dissipate a little bit of power 🙂

honest obsidian
#

What's the difference between these two ATmega328 boards on Adafruit's website. One has 20 GPIO advertised while the other has 19 and that seems like a typo <@&669538345994682378>

topaz compass
#

Should be no difference between the two boards as far as functionality/design, as far as I can see.

honest obsidian
#

That's what I figured as well. Double-listing, I guess. Probably for historic reasons. Idk.

topaz compass
#

No, one board comes fully assembled, while the other requires assembly (soldering headers)

honest obsidian
#

They both say "fully assembled." PID: 2488 says "fully assembled" in the description and PID: 50 says "fully assembled" in the product title.

topaz compass
#

That's weird. I thought all the products that say "with headers" were loose headers

honest obsidian
#

🤷🏽‍♂️ maybe one of the Adafruit folks will reply tomorrow.

leaden light
#

How to solve this whenever I tried to connect nodemcu it shows this error

#

I had download driver

#

Also I download library

#

And Arduino ide didn't detect it

pliant totem
#

guys, question, does anyone know about ROS with an arduino?

#

are subscribers in arduino only toggleable?

#

im currently using this code, basically im trying to sub the arduino to my computer to try to listen to specific values. When these specific values are met, the led will toggle on, if not, the led will turn off

#

how can i specify the subscriber to listen for specific cues?

north stream
#

@leaden light Do you know which serial chip your board has? Can you get a listing of the vendor ID and product ID of the unknown chip?

leaden light
#

😅ty for helping my problem was solved after watching 2hour yt videos .
Problem is on usb cable after changing it nodemcu works👍🏻@north stream

leaden light
north stream
#

If you've got it fixed, that doesn't matter, good job figuring it out.

calm parcel
#

Can someone recommend MQTT arduino library that supports TLS?

cedar mountain
tawny veldt
#

@calm parcel Adafruit MQTT Library

#

alt. the MQTT library by knowlellary(? spelling might be wrong)

queen sigil
#

I’ve got a bit of an odd question. Does anyone know where I can get a Mega without any headers on it?

shadow tusk
queen sigil
shadow tusk
#

It does mention that it has the mega shape and pinout

#

If you go to the "Pinouts" page of the guide, it has all the details

queen sigil
shadow tusk
#

That's great! Good luck to you on your project! Come back and show it off if you can, and if you have questions, you know where we are 🙂

queen sigil
#

Will do!

thick stag
spiral knot
#

Hello! I tried connecting my 128x32 OLED to my new nRF52 Feather, however the buttons are not working. I'm using the example code 😦

soft kelp
#

Hello, Can someone explain me what this bit of code does? I'm new to using interrupts

TCCR0A = 0; //clear timer0 register (TCCR0A)
TCCR0A |= (1 << WGM01); //set the CTC mode for timer0 with OCRA as top
TCCR0B = 0; //clear timer0 register (TCCR0B)
TCCR0B |= (1 << CS00) | (1 << CS02); //set prescaler of timer0 to 1024
TIMSK |= (1 << OCIE0B); //activate timer compare match interrupt for OCR0A and OCR0B

green crypt
#
TCCR0A = 0;                                 //clear timer0 register (TCCR0A)
  TCCR0A |= (1 << WGM01);                     //set the CTC mode for timer0 with OCRA as top
  TCCR0B = 0;                                 //clear timer0 register (TCCR0B)
  TCCR0B |= (1 << CS00) | (1 << CS02);        //set prescaler of timer0 to 1024
  TIMSK |= (1 << OCIE0B);                     //activate timer compare match interrupt for OCR0A and OCR0B
soft kelp
#

Ah! thank you. I didn't know how to do that.

leaden ruin
#

You're setting the control registers for timer0. Looks like some kind of PWM scheme, my AVR skills are quite rusty.

#

Could be waveform generation mode 1 (WGM01), the timer runs at the base frequency/1024, and you get two interrupts per cycle. OCR0A would control the PWM frequency and OCR0B sets the duty cycle.

#

Maybe your interrupt code would toggle a pin on each invocation, so you get to pick the pin doing the PWM. I think some pins can be directly connected to the timer, in which case you wouldn't need an interrupt.

queen sigil
thick stag
#

I've had lots of success with third party boards. But fair enough. Adapting code for a first party board could be better

elder hare
#

what resistor value would i need for a white LED?

safe shell
#

Adafruit's white LEDs are spec'd as "3.0-3.4V Forward Voltage, at 20mA current"

pine bramble
#

arduino gang

#

😎

sterile scaffold
#

Hi, I bought a bunch of Adalogger featherwings and feather M0 LORA boards and I'm not able to get the SD card reader to work on any of them. I can get the RTC to work, but the CardInfo sketch constantly returns "initialization failed.". I have set chipSelect to 10 and confirmed that the SD card has clicked in. I have formatted the SD card with the official SD card software linked on adafruit and confirmed it works with an older WickedDevice Arduino with SD card reader. I have continuity tested every single pin between the feather and the shield. I have tried a different arduino with a different shield on it (I bought 6 of each). I have done a clean install of the Arduino studio with freshly loaded libraries on a separate computer. NOTHING WORKS. I'm at my wits end here. Is the M0 Lora just not compatible with the SD card logger or something (maybe LORA uses the SPI pins as well and creates a conflict)? Any suggestions on how to make this work would be appreciated.

elder hare
#

Trying to controll brightness of LED's with a potentiometer but the values are something stuttering and it results in the LED's flickering

//===================================================================================================================== //
// INCLUDES
//===================================================================================================================== //
#include <Arduino.h>
#include <FastLED.h>
#define NUM_LEDS 24
#define DATA_PIN 2

CRGB leds[NUM_LEDS];

float smoothADC;

int sensorPin = 0;      //pin number to use the ADC
int sensorValue = 0;    //initialization of sensor variable, equivalent to EMA Y
float EMA_a = 0.6;      //initialization of EMA alpha
int EMA_S = 0;          //initialization of EMA S
//===================================================================================================================== //
// SETUP
//===================================================================================================================== //
void setup() {
  Serial.begin(115200);
  
  LEDS.addLeds<WS2812,DATA_PIN,RGB>(leds,NUM_LEDS);
  LEDS.setBrightness(100);
  EMA_S = analogRead(sensorPin);
}  
  
//===================================================================================================================== //
// MAIN LOOP
//===================================================================================================================== //
void loop() {
  
  smoothADC = 0.9 * smoothADC + 0.09 * analogRead(0);
  //Serial.println(smoothADC);

  int mappedValue = map(smoothADC, 0, 1023, 0, 255);
  Serial.println(mappedValue);
  
  fill_solid(leds, 24, CHSV(255, 0, 255));
  FastLED.show(); 
  LEDS.setBrightness(mappedValue);

}

what am i doing wrong?

pine bramble
#

At first glance you keep setting the fill on the loop

#

Consider changing it so you don't set the fill/value unless it changes

odd fjord
sterile scaffold
#

YESSSSS!!!! This totally works, thank you so much!

odd fjord
#

Great! Glad it worked!

sterile scaffold
#

I was on here a month or so ago with another person trying to help and we just kept banging our heads against the wall, and I've been doing that on my own as well. I think I was close there thinking that the LORA chip might be conflicting with the SD card, but I never caught the PIN 8 note

#

thanks so much

grave horizon
#

How do I set a color for my whole Adafruit NeoPixel 5m strip? I mean without a fading or Wipe effect?

rough torrent
#

.fill()? (IDK if that's a function, but I think it is) I haven't touched Neopixels in a while...

grim plaza
#

I am doing a project with an arduino uno but I don't know how to code it. so I want the code to do this:I want it so that when the temperature is below a certain number for example 60 the lights will start at a light blue and as it gets colder the lights turn into a darker blue. And the same thing for how hot it is just with red not blue.

#

I'm using a thermister for the sencors and LED strip lights for the lights

#

I have my circit set up like this right now

#

Arduino MOSFET Circuit

north stream
#

I don't see where the thermistor is hooked up, but basically, you'd configure it as a voltage divider with a resistor, and hook the junction to one of the analog inputs. Then you can use analogRead() to read the value from the thermistor, then use math to figure out the various brightnesses for the LEDs, and write those values out to the LED control pins with analogWrite().

sinful saffron
#

I've been stuck on trying to get DMX working on a semi DIY board with a MAX485 chip for a couple weeks. I know the output device for DMX is working since I can control lights, and I've looked at the signal via an oscilloscope and compared it with the input and it matches (just with 0-5v instead). My custom board is based on and designed around this one http://www.mathertel.de/Arduino/DMXShield.aspx . I'm using it solely to receive DMX for now using the DMXSerial library.

spiral knot
#

Hello! I tried connecting my 128x32 OLED to my new nRF52 Feather, however the buttons are not working. I'm using the example code 😦

leaden light
#

I can't get blynk cloud ip from my command prompt for webhook it gives me alphabetical ip. How to get exact ip??

#

For node mcu automation

vivid rock
#

@spiral knot can you post the link to the example code you are using? there many examples...

pine bramble
#

who wants help

elder hare
#

i went in another direction 🙂

marsh forge
#

Looking at https://github.com/adafruit/Adafruit_Sensor/blob/master/Adafruit_Sensor.h it appears the Github version differs from the version I pulled down through the Arduino IDE. If I update my Adafruit_Sensor.h file with the version in Github the errors clear. I am working with Adafruit Sensor Calibration version 1.1.2 in the IDE. Is the Github code the most current?

crude loom
#

I have a new Datalogger Shield with the 8523 RTC, which I can't get to work, when I run the example from the RTClib I get the following - "Couldn't find RTC" I put a fresh battery in, and waited before loading the file "pcf8523" from the examples folder. The SD card part works great, but the RTC nothing..

marsh forge
supple sail
#

Hello, complete Adruino noob here. Bought an Adafruit Metro and a couple Adalight project packs and having some strange issues with the lights.
I followed the tutorial at https://learn.adafruit.com/adalight-diy-ambient-tv-lighting/overview
to get everything hooked up, and had some with mismatch errors when initially uploading the LEDStream sketchbook they provided. After a few tries I got it to upload and Colorswirl works but the lights are pretty flickery (2 25 strands of the WS801 they provide with the kit), and the Adalight code does nothing.
When running PSIEG's fork of Prismatik the lights start up and behave somewhat like they are supposed to, but not really; some are off color and when I change to mood lighting and try to select a static color, it changes on most, some flicker a bit, some a few wrong colors....

When I connect just the 5v DC to the lights (no Metro) the lights light up erratically. Sometimes different colors, sometimes a few flicker, etc.

Oh, also if I wave my hand over the end lights, depending on the configuration, the lights will shut off or change colors. 🤷‍♀️
I've tried flashing FastLED to the Metro, but I can't flash anything again as I just get more mismatch errors...

Can somebody with some experience in all this please lend me a hand? I'm really at a loss as I've spent the last couple days looking up everything I can on Reddit, Adafruit forums, etc and I just can't figure this out...

Adafruit Learning System

Mood lighting for your media PC

#

Oops, sorry when I said 'flashing' I meant uploading from Arduino IDE to the Metro

supple sail
#

Hello, can anyone help or point me in the right direction if not?

thick stag
#

@supple sail Can you share photos of your circuit

supple sail
#

Certainly
Here ye be

thick stag
#

And what does your code look like?

#

Also do you have a better photo of how the wiring is setup from the MEtro to the lights?

#

IT's kind of hard to tell what the red, green, and blue wires are connected to

supple sail
thick stag
#

Did you modify anything in there or is that straight from the example?

supple sail
#

nothing changed. The wiring from lights to metro goes:
Blue to GND
Green to 13
Yellow to 11

Though I have a 4pin connector between them that has different colors, to make it easier to connect.

#

thank you for helping btw

#

I cannot upload any code to the metro it seems. The PC I am using is full of USB 3.0 and '3.1'. Should I try another PC?

thick stag
#

are you using the arduino IDE?

supple sail
#

Yes.

thick stag
#

YOu should be able to unplug the microcontroller, plug it back in and check that the correct port is selected under tools

#

sometimes these devices are a bit finicky

#

also changing to a different usb port helps sometimes

supple sail
#

Yes, I have double checked the COM, it is set right; have also tried a few different ports/USB cables.

I forgot a detail. When first connecting the Metro to PC with USB, it did say it was installing a driver, however as on the Metro info somewhere it said I would need to install a 2014 driver... So I followed some links that were now defunct, and installed the CP210x_VCP drivers. Then when that didnt' seem to work right I installed the adafruit/Adafruit_Windows_Drivers from Github (without uninstalling the previous ones).

Now, if I uninstall the Metro COM driver from device manager, the Metro doesn't automatically detect one when plugged in and I have to install again.

thick stag
#

I'd disconnect everything and try and figure out how to get a basic sketch working first.

#

I'm not familiar with Metro so I can't help with those specifics. But getting back to a basic setup should make debugging easier

supple sail
#

I got it to upload once, and I can run Colorswirl sketch with no issue, but the lights are flickery.

#

Is the behaviour described in my OP from the lights when not connected to the Arduino expected?

#

Metro is described as being the same as the UNO

supple sail
#

@thick stag Hello again. So I broke everything down, removed all drivers that were installed and started fresh.

I can run blink and it works, but I still get verification errors.

avrdude: verification error, first mismatch at byte 0x003f
0x80 != 0x00
avrdude: verification error; content mismatch
avrdude: verification error; content mismatch

thick stag
#

You'll probably want to copy those specific errors into Google and read the arduino forums

#

(I wouldn't know without doing the same)

supple sail
#

All good, I have been searching everything I come across so no shortage of that here.
I appreciate that you took the time to make some suggestions though.

If I didn't want to tinker, I wouldn't!! 😄

thick stag
#

Hah glad to help

#

There's always a balance between getting immediate feedback and bouncing around google 😄

#

Always good to exercise the google muscle

zenith orchid
#

Hello everyone, i have a question. Im using an atmega328p to read from an mpu6050 via i2c. Iam also using a timer that keeps time in milliseconds. Im using timer2 with 16MHz crystal and a presalacar of 64. Every 1024us (1.24ms) an interrupt occurs and a variable is increment by 1 to count milliseconds. My concern is, wouldnt the interrupts affect the i2c communication?

north stream
#

Like many questions, it depends. For one, the ATmega has hardware support for I2C, so it doesn't have to depend on the CPU. For another, I2C is synchronous, so the CPU controls the timing. However, some implementations don't use the I2C hardware and do depend on the CPU for timing. Additionally, some I2C sequences use tricks like "clock stretching" that make it more complicated and subtle. So the short answer is ... "maybe".

still plaza
#

I've got a circuitplayground express that I'm using the Arduino LowPower library with. Does anyone know what happens to the Neopixels if I tell the MCU to sleep or deepsleep?

#

Not sure if the neopixels have their own processor or something

north stream
#

They do, but they only change state when sent data. As long as the sleeping MPU doesn't send them something confusing, I would expect them to continue displaying whatever they were last sent.

still plaza
#

Ahh I see

#

Great. Thanks!

still plaza
#

Hmm somewhat related problem: I can't get the CPX button A to trigger an interrupt to wake from deepsleep. I register both CPLAY_LEFTBUTTON and CPLAY_RIGHTBUTTON, but only button B triggers the interrupt. Button A does nothing.

#

I'm using pin 4 and pin 5. Is that correct?

#

Or should I be passing it interrupt IDs or something?

#

The function is (Arduino)LowPower::attachInterruptWakeup

still plaza
#

Okay I dug out the offending code in the arduino library I think...

#

in framework-arduino-samd-adafruit/variants/circuitplay/variant.cpp, button B (pin 5) is listed as EXTERNAL_INT_14 while button A (pin 4) is listed as EXTERNAL_INT_NONE.

#

This fails the check in ArduinoLowPower.cpp on line 97 (in == NOT_AN_INTERRUPT) so it just refuses to register the pin as an interrupt.

#

I don't know who's at fault. Is the variants.cpp definition correct? Is ArduinoLowPower reading that value incorrectly? Are they both using the same field to mean different things?

still plaza
rancid zinc
restive gazelle
#

Need assistance: purchased ""1.44inch LCD Display HAT 128x128 Pixel SPI Interface Direct-pluggable onto Raspberry Series Boards Examples for Raspberry Pi/Arduino/STM32 Driver ST7735S"" from Amazon based on the indicated 'examples for Arduino' in the item's title. sadly, was bought more than 2 months prior to a project build, so no returns based on the seller's error. question: is there ANY way to make this HAT work with an Arduino Nano, including the buttons? was referred to this discord in the Q&A section of reviews for possible help getting this off the ground...

obtuse spruce
#

do you have a pinout of the device?

#

But I can't think of any reason why it wouldn't just work on a development board rather than a Pi.

restive gazelle
#

sec, i have the manual, which has the pinouts...

obtuse spruce
#

@rancid zinc - I'd doubt it. But... that display has a full internal buffer, so unlike many others, you shouldn't be needing to send the whole display on each refresh, just redrawing what you need.

restive gazelle
#

@obtuse spruce or not, apparently....

rancid zinc
obtuse spruce
#

@restive gazelle - without the pinnout, it'd be hard to know... BUT - it would seem likely that the device just needs SPI, and 8 or so GPIO likes for the buttons and joysitck. This should interface to a nano (assuming you have enough free GPIO, which depends on which nano model and what else you are doing.)

#

I general, I don't buy devices like this off Amazon, even if they are 1/2 the cost - because the effort that Adafruit and Sparkfun and similar places make to have the technical documentation available and clear is more than worth the extra $.

#

Without the pinnout, you can only guess...

#

Mind you, you could probably probe it with a multimeter and discover where all the switches are

restive gazelle
#

@ mzer0 found a pinout on the waveshare page

#

@obtuse spruce sigh. typing skills are lacking without more coffee...

#

SYMBOL RASPBERRY PI PIN (BCM) DESCRIPTION
KEY1 P21 Button 1/GPIO
KEY2 P20 Button 2/GPIO
KEY3 P16 Button 3/GPIO
Joystick Up P6 Joystick Up
Joystick Down P19 Joystick Down
Joystick Left P5 Joystick Left
Joystick Right P26 Joystick Right
Joystick Press P13 Joystick Press
SCLK P11/SCLK SPI clock input
MOSI P10/MOSI SPI data input
DC P25 Data/Command selection (high for data, low for command)
CS P8/CE0 Chip selection, low active
RST P27 Reset, low active
BL P24 Backlight

dark gust
#

Yo what's up y'all

#

I recently bought an Arduino board and I'm wondering if any of y'all got good starting pointers for it

obtuse spruce
#

okay - so, sure - that should hook up to a nano... you'll just need a lot of jumper wires!

#

@restive gazelle which model nano do you have?

#

@dark gust - what sort of things are you interested in doing? did you get any other things to go with the board you got, like light strips, or leds and a breadboard, motors? etc?

dark gust
#

Well I bought the official Arduino Starter Kit but I really didn't know what else to buy with it cause you know how it is with Amazon, they try to make you buy things with it and sometimes they don't even make sense. Although, what I am trying to do with the Arduino is use it as a way to get into the rabbit hole of electronics like hooking it up to other components or electronics and make it do things

#

But currently what I want to do with the Arduino is get a good solid guide to learning it before I try to do anything complicated with it. Although I am really trying to get into electronics, circuitry so I can do some pretty interesting things with it later on the road

#

I know some wiring basics since I used to work as a electrician but I know the Arduino is a different beast cause you have to code and such

obtuse spruce
#

Start there

dark gust
#

Dope, so the starter kit itself is what I need to learn the basics before anything right?

#

I shouldn't buy anything currently?

obtuse spruce
#

didn't the starter kit come with 170p book?

dark gust
#

Yup that's it

obtuse spruce
#

It it's that kit (or very similar) - then you've got plenty to keep you going for a while and learn the basics

dark gust
#

The one you linked is spot-on that one

#

I didn't wanna buy any clones so I went for the official one

obtuse spruce
#

Okay - that also has a project book, and those'll be directly applicable

restive gazelle
#

@obtuse spruce VID: 1A86 PID: 7523

dark gust
#

So would you suggest I start with the link you provided and then the book? Cause I want to learn it in a ABC order rather than hopping to different topics if that makes sense

#

Cause I usually get tangled up when it comes to learning programming and such since you can start to focus on one area too much

restive gazelle
#

@obtuse spruce ELEGOO Nano Board CH340/ATmega328P

obtuse spruce
dark gust
#

Thank you regardless mzero

#

I'll be seeing y'all later

obtuse spruce
#

@dark gust - I don't know the book, so can't say, but assume that it is designed to go start to finish in a clear order. The Lady Ada page is a good start from zero "what is all this" - but then it let's you jump off as your desire goes.... I'd start with the book

#

So, sure - you've got enough pins and SPI on the Nano - just, er, hook it up!

dark gust
#

Ahhhh so as you start learning the basics you start to get an idea of where you want to go and by then, you should already have a clue or idea of where you should go by there

restive gazelle
#

@obtuse spruce yes!

dark gust
#

Sounds pretty set, thank you for the help mzero, have a good one

restive gazelle
#

@obtuse spruce now just need to know what the equivalent pinouts are between Pi and theNano (or for that matter an Uno R3, since i can cross between Nano & Uno)

obtuse spruce
#

Don't approach it like that... Instead, look at the pinout of the display and see where on the nano pinout they correspond to

#

You can forget about the Pi pinout here

restive gazelle
#

@obtuse spruce ... point well-made, and taken, sir!

coarse smelt
#

Anyone have any experience coding MIDI controllers?

obtuse spruce
#

yes

#

and there are probably more over in #help-with-audio (which isn't strictly audio!)

fresh hemlock
#

So basically I want read the output from the serial monitor into my python program. But when I run both the arduino program and the python program (using com5) it says access denied. Can both programns not use the same com??? Here is my python code (from a website) ``` import serial
import time

set up the serial line

ser = serial.Serial('COM5', 9600)
time.sleep(2)

Read and record the data

data =[] # empty list to store the data
for i in range(50):
b = ser.readline() # read a byte string
string_n = b.decode() # decode byte string into Unicode
string = string_n.rstrip() # remove \n and \r
flt = float(string) # convert string to float
print(flt)
data.append(flt) # add to the end of data list
time.sleep(0.1) # wait (sleep) 0.1 seconds

ser.close()

for line in data:
print(line)```

#

and the arduino program just prints to the serial monitor

#

How does one read the serial output from the arduino and put it into the python

rough torrent
#

You cannot have two programs access a serial port at the the same time

#

Closing the serial monitor should free it, allowing Python to take it

fresh hemlock
#

Ahh

#

thanks

reef ravine
#

or run the terminal program for one or the other on a different com port

pine bramble
#

I usually connect two targets, TX to RX each way and do everything on the local serial (the one setup by:
Serial1.begin(9600);
in the Arduino IDE world.

#

(Serial, not Serial1, is the USB port)

deft oak
#

I've been having a lot of problems getting Arduino to upload a test program to a ESP32 Feather in Ubuntu Linux

#

Traceback (most recent call last):
File "/home/jim/.arduino15/packages/esp32/tools/esptool_py/3.0.0/esptool.py", line 38, in <module>
import serial
ImportError: No module named serial

#

I only get this error when I'm using an ESP32 or ESP32S2

reef ravine
deft oak
#

@reef ravine I'll study that some more, but I tried to install something else not Arduino related the other day and it would not work with that package to force Python3 for python

#

@reef ravine Thanks, 2 parts to the solution. python-is-python3 and apt-mark-hold a bunch of 2.7 packages

#

I think virtualbox was the package that hates python-is-python3

barren mango
#

Good day all. I am building a Steam Punk clock that will be driven buy a NEMA 17 stepper motor. I'm a mechanical guy, not electrical or a programmer in any way! Here is my dilemma. I was able to get it running and turning at the needed 60 RPM using an Arduino Nano and a little DRV8833 driver bd. It works but is very noisy!! I'd like to be able to make it run quieter. I think that it can be done, because I guy at work showed me my motor running off of something he had. So you ask, why can't he help? I can only say that he is extremely busy, and I don't think he wants to be bothered. So, is this even the place to ask? I would love to be able to work with someone. I would be willing it compensate that person. I'm in the Syracuse NY area. I can be reached: 3261ford@gmail.com

#

Additionally, I'm not familiar with this format. So, if I'm not doing this right, I mean no disrespect. Thanks, Sid

reef ravine
#

@barren mango have you tried adjusting the trim pot on the driver (a little at a time) to see if more (or less) current limiting helps? no problem but a question like this is probably better suited to #help-with-projects

barren mango
#

There is no trim pot on the driver bd.

dusk prism
#

Hi folks, I don't know much about coding/arduino. However, I followed a tutorial to create a button box using an arduino leonardo.
All is well and good except that my rotary encoders seem to only register once for every 2 "clicks" in either direction.
The buttonbox code is from this video: https://www.youtube.com/watch?v=wkY1NsbWj5I

IMPORTANT: I mistakenly said you can use Arduino Uno for making a button box. That is INCORRECT Uno will NOT work with this guide. You can only use Arduino Leonardo or Pro Micro.

How to design, build and code your very own button box using arduino! Perfect for flight sims, racing sims or space sims.

This video covers how to build a box using ...

▶ Play video
#

And this is the datasheet for the rotary encoder.

#

I have no idea if it's just a factor of the resolution of the encoder? or something in the code I need to adjust.

pine bramble
#

Hey folks, anyone know why my LCD won't dim when I wire my VO pin to a potentiometer?

bitter needle
#

What kind of LCD, something from the Adafruit shop? How are you connecting the pot?

pine bramble
#

An LCD1602

#

It's not from the adafruit shop

cedar mountain
#

Note that the VO line is the LCD contrast adjustment, so it won't control the backlight brightness, if that's what you were expecting.

pine bramble
#

Oh alright. But even then, it doesn't adjust the contrast

#

Here's what i'm going off of

deft oak
#

I'm trying to use Arduino IDE on Ubuntu with ESP32-S2 Metro, which I know is in early development, but I can't even upload the Blink sketch. I have installed the board package per the method on the learn.adafruit.com site, but I get an error on upload. I had this work about a month ago, but I've re-installed Arduino since then. The error is OSError 71 protocol error. BTW, I can use Windows 10 Arduino with ESP32-S2 and upload the code, but I can't connect to the Serial console after I reset the board. Windows says no Comm port... EDIT: the only solution I found was to blow away my hard drive and reinstall Linux. that worked. but took a few hours

hollow cypress
#

Is there any success traversing a VPN over Ethernet with Arduino ? If so, what is the best target and shield for this ?

obtuse spruce
#

As in, you want one end point of the VPN to be on the Arduino? Do you want an encrypted VPN, or is this just IP within IP?

elder hare
#

https://www.circuito.io/app?components=513,12787,360217 what is this magical pin 0.... it is not labeled on my esp32 devkit 😐

hollow night
#

@obtuse spruce IP within IP. No encryption necessary.

safe shell
#

@elder hare It could be labeled BOOT or similar, or could just be a button. You should be able to use a different pin and adjust the code. You generally don't want any signals going in to GPIO0 at boot time, it affects whether it starts up normally or goes into the bootloader https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection

obtuse spruce
hollow helm
#

Hello, is it possible to have a 3V microcontroller board send data one-way over TTL serial to a 5V board? Specifically, a Circuit Playground Bluefruit to an Arduino Uno?

#

Does the Arduino recognize 3V input as a HIGH signal? Do I need to do anything special with the wiring to avoid frying the Circuit Playground?

#

Second, can I use both the Arduino IDE serial monitor over usb with the Arduino at the same time as the Circuit Playground?

#

Will it cause problems during programming over usb?

#

If there's a better way to get a Circuit Playground Bluefruit and an Arduino Uno to communicate, please let me know.

pine bramble
hollow helm
#

Thank you, but this doesn't answer my question. That pdf provides Table 4-1, but I don't know the correct values for the Arduino and Playground.
Second, I don't know which of those tips to do. It talks about the "switching speed of the input", the current consumption, noise, etc, but I don't know what these values are for serial.

rough torrent
rough torrent
rough torrent
hollow helm
#

Thank you. Just to confirm, there is no required circuitry between the Bluefruit TX and the Arduino RX pins, and this won't cause damage?

reef ravine
#

A 3.3v output will usually be enough for a 5v input (a level shifter may be required) and there is no risk of damage. 5V to 3.3v does risk damage and so a voltage divider or level shifter is required.

hollow helm
#

Thank you

spiral knot
safe shell
#

@spiral knot Yes, the OLED uses I2C, and the SD uses either SPI or SDIO. It's just a question of how you have it physically set up to access the needed pins. On a breadboard, no problem.

elder hare
#

Keyboard.h:25:17: fatal error: HID.h: No such file or directory #include "HID.h"

i can't find that HID library :S

north stream
#

It's usually part of the hardware/CPU/board package.

pine bramble
#

Can anybody tell me the which pin goes to which?

#

I don't need the touch functionality

errant hound
pine bramble
#

If anybody can give me the connections specific to this that would be great

errant hound
#

i literally just did? 🧐 no?

#

thats using the other spi port... same idea tho

pine bramble
#

Yup, thanks

elder hare
#
strong perch
slim shell
#

How do I make my Arduino Uno/Nano/Pro micro/ into a low power mode? Is there some built in function?

slim shell
native kelp
#

would it be 5afe to connect a 10mA rated encoder to an arduino pro micro, or would the power output from either the VCC or the digital pins be too much for the encoder?

#

and unless im being scammed, that'ss how the rotary encoder looks like

#

i haven't bought it yet, because of this question

reef ravine
#

@native kelp it looks like a typical rotary encoder (3 pins one side, 2 on the other)
Digital input pins draw almost no current, if you wire it right almost no current flows through the encoder.

#

The 10mA rating just means don't pass power through it.

native kelp
#

So i can just wire the right pins to VCC and GND and it'll be fine?

#

And then the other data pins to the digital input

reef ravine
#

a rotary encoder is wired like a push button, not across Vcc and ground

native kelp
#

Oh

#

But I have to look at two signals to check if its beimg rotated clockwise or counterclockwise

reef ravine
#

yes

#

Vcc > 10K > switch > ground

#

the 10K limits current to 0.5 mA

#

then A & B are the outputs

native kelp
#

But VCC and GND still goes to VCC and GND on the board

reef ravine
#

yes, but not directly across the encoder, the resistor is in series

native kelp
#

Not directly across the encoder?

reef ravine
#

no, if direct you make short circuits as you spin the encoder

native kelp
#

Oh

reef ravine
#

it's like a switch, never connect across Vcc and ground

#

in the circuit above, if the switch is open the 10K pulls the pin up to Vcc (HIGH), if the switch is closed it pulls the pin to ground (LOW)

#

the R's and C's left and right are optional

#

the 10k's in series with the switches are not optional

native kelp
#

Oh right I thougjt the diagram was of the encoder only, I thought it already included all of those

reef ravine
#

just the switches inside the dashed lines is the encoder

native kelp
#

Yep

reef ravine
#

looks like the one you showed also has a push switch

native kelp
#

The specifications didnt necessarily specify, but considering most of the other encoders i found on the store also have buttons, it may have thag too

#

But some encoders have the resistors built in, the ones that seem to have a whole circuit board on them, right?

reef ravine
#

if it's sold as a module could be

#

but be sure to check the datasheet before applying power

native kelp
#

Yeah i would if they will provide

#

For now i either have to find one with resistors built in or source them myslef

reef ravine
#

it's just two 10K resistors, a very common value, handy to have on hand

native kelp
#

I see

#

Thanks for the help

reef ravine
#

good luck with it!

native kelp
#

Thanks!

winged dagger
#

I'm trying to adapt this bit of a code to work on my Gemma M0 instead of an arduino, is it not enough to have changed RECEIVER_PIN 2 to RECEIVER_PIN A0?


#define RECEIVER_PIN A0 // define the IR receiver pin
IRrecv receiver(RECEIVER_PIN); // create a receiver object of the IRrecv class
decode_results results; // create a results object of the decode_results class

void setup() {
  Serial.begin(9600); // begin serial communication with a baud rate of 9600
  receiver.enableIRIn(); // enable the receiver
  receiver.blink13(true); // enable blinking of the built-in LED when an IR signal is received
}

void loop() {
  if (receiver.decode()) { // decode the received signal and store it in results
    Serial.println(results.value, HEX); // print the values in the Serial Monitor
    receiver.resume(); // reset the receiver for the next code
  }
}```
prime island
#

Hey homies, would this be the right place to get some help regarding LED's and resistors?

vivid rock
#

or here - doesn't matter much

tiny tinsel
#

Hello, I'm not sure where to ask for help. So I would just ask here since it involves arduino

#

I am building a datalogger using DS3231 and sd card breakouts

#

I'm still not sure how to format the datetime when saving the data

#

I was reading about ISO8601 format like this 2021-02-01T20:58:23+08:00

#

Is that the right way to save the datetime?

#

I would use the log data to plot a graph

shadow marlin
#

@tiny tinsel to be clear, this is an excel question, right?
some experimentation should solve the problem.
just open up a text editor like notepad++ and try some formats until you figure out what excel wants.
or search the internet some https://stackoverflow.com/questions/4896116/parsing-an-iso8601-date-time-including-timezone-in-excel

#

ancient but the idea seems fine

tiny tinsel
#

The problem was that I wasn't sure I was doing the right thing by using that date format.

#

But thank you for that. I can get the parsing correct now

vivid rock
#

Of course, you can always use UNIX timestamp (=#of seconds since Jan 1, 1970); this way, it is just a 10-digit unsigned integer, and there plenty of utilities to convert it to any time format you want.

pine bramble
#

I'm considering doing a Julian Day calculator. ;)

green heath
#

hello, I am writing a C program for a piezzo buzzer. its attached to an 8 bit timer2.
for all intents and purposes I am tone deaf. ive got something in a square PWM wave thats supposed to sound like an a4(it matches the frequency not quite to the decimal) note. but I dont know how an a4 note sounds. are there any sources short of recording all sounds from an arduino sound library?

obtuse spruce
#

"A4" is just a frequency. It can sound all different ways depending on the instrument or waveform used. It is only the frequency that makes it "A4". So if you know that what you're outputing is a 440Hz square wave, then that is an A4 note.

shadow marlin
#

@green heath I'm not sure if this is the question, but you could get an app for your phone that will generate the "correct" frequency. Probably. And also tell you what it thinks the note you are producing is. I have one called Cleartune for iOS, it's ancient but all I ever needed.

green heath
#

mmh, I figured I could use my fendertune app but it was quite limited to the guitar notes

shadow marlin
#

Oof. Same principle.

green heath
#

and I cant really tune it other than calculating the right frequency and writing it to the compare match register xD

magic field
#

I have a free android app that will generate a tone at any frequency.

shadow marlin
#

that is more useful information if it comes with a name or a link

green heath
#

Indeed

#

I wanted to program a sine wave for the buzzer but i just dont get how. You have a 440hz sine wave and you need to get an 8 bit value for one phase?

#

For each step

vagrant spade
#

Does the Arduino Pro mini 8MHz use a cermamic resonator or a crystal?

shadow marlin
#

Remlly theres lots of information on the internet about producing sound from a buzzer. Maybe you could spell out "the rules of the game" for you? It sounds like you're trying C with interrupts, no external circuitry? Try googling something like "arduino DDS sinewave generator"? Or are you trying to figure this out without somebody else's walkthrough?

green heath
#

I have a book about standalone avr programs

#

I am coding on a shield

#

The book only has an include "fullsinewave.h" thats nothing more than an array with 8 bit integers

#

Ive gotten pretty adept at initializing the whole avr hardware but actually using it for more than a motor or a pre soldered 7 segement display wasnt really thought haha

#

Currently struggling with the usart thats only transmitting <0><0> in a feedback loop

formal crypt
#

id like to build a data logger I can attach to a motorcycle battery and log data from gps, acclerometer, and servo/potentiometer (suspension travel).

#

im a software engineer, i have a friend who's built some stuff for collecting weather/gps data. Just looking for help building a parts list.

#

arduino, gps, bluetooth, sd card slot, whatever I need to pevent voltage spikes from blowing up the arduino...

#

validation, friendhip, etc...

shrewd wyvern
#

You should break your project

#

Start by getting an arduino and some of the sensors you wanna use

#

when you are able to get that get an SD shield or whatever to see if you can store the data

#

depending on the acquisition speed and the amout of data you want you can start to have problems here

#

so at this point you will start thinking if you should change from arduino to other stuff

#

after having that working start thinking about the power supply (voltage spikes and stuff I guess)

#

And at the end you will probably what to make it smaller and fit it in a box

twilit hare
#

so, I'll start by saying that I know that Arduino on the ESP32s2 is flaky; that being said - has anyone gotten a "Serial.print" statement to work? I'm able to upload code; however, the ESP32s2 doesnt seem to find the com port after reset. Anyone else having that problem?

formal crypt
# shrewd wyvern when you are able to get that get an SD shield or whatever to see if you can sto...

Thanks for the advice. I have no idea what frequency i'll need for the data to be of use. Its important to me that I can build this as cheaply as possible in case this turns into a good idea for other people to build. My friend's already walked me though a lot of the issues he's had collecting gps and weather data. I'm just looking for recommendations on parts and making sure I buy everything I need given this is my first foray into assembling hardware.

shrewd wyvern
#

I have never used that shield... But usually Adafruit stuff is well supported and documented so I'll give it a go...

#

I know it looks a bit strange but you should try to build your project using these type of shields and in the future when (for example) trying to make a kit out of it, replace some of the parts for cheaper ones that you will find about while developing

flint birch
#

Hi. I am working on my first LED/programming project. I am not sure exactly where to start. I have been googling but am overwhelmed by the number of results and different programming options. I'm trying to learn how to create/program LED animations using the hardware below. Could anyone suggest a good guide or a good search phrase for me to use to do more research? My hardware is below. Thank you for any help anyone can provide. 🙂

https://www.amazon.com/gp/product/B081PX9YFV/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1

https://www.amazon.com/gp/product/B01CDTEGGO/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1

thick stag
#

@flint birch Few questions first - Did the Mini D1 come soldered together and if so have you soldered it together?

#

Do you have a breadboard and jumper wires?

flint birch
#

What do you mean soldered together?
I do have a bread board and jumper wires.

thick stag
#

Are the header pins that came with the Mini D1 attached to it or separate?

flint birch
#

Separate.

thick stag
#

Do you have a soldering iron?

#

If not that'll be your next purchase before you can continue

flint birch
#

I do have a soldering iron.

thick stag
#

Or if you don't want to solder you'll need to purchase a different microcontroller

#

This video is a good place to start, different board but same idea - https://www.youtube.com/watch?v=3230nCz3XQA&ab_channel=learnelectronics

In this video we look the technique I use when soldering header pins to the my One Hung Lo Chinese Arduino clones like the Nano, Pro Mini, and Pro Micro. While this short tutorial centers on soldering the pins to these boards, the technique is applicable to situation where you need to solder header pins to a board.

The pins are inserted from th...

▶ Play video
flint birch
#

I have soldered before so I feel somewhat confident there, but this video should be very helpful. 🙂

#

I'm a mechanical engineer so I'm good with my hands. The software and coding part is where I know I am going to struggle and need help with.

thick stag
#

Ah that video is just more on how to deal with microcontrollers coming unassembled

#

Also 👋 fellow meche I started my career as one and am now a software engineer

#

Also a tip for the future, when you get a new piece of tech, I usually like to start off by googling "arduino [part name here]"

#

Might be useful to initially cut like 3 LEDs off and not use the whole strip because your arduino might not be able to power them all without external power

flint birch
flint birch
flint birch
thick stag
#

If I were you, I'd avoid the power supply to begin with. Unless you're absolutely sure you know what you're doing. You can't really do any harm with the power coming out of an arduino connected just to a computer. A power supply connected to the wall can be quite dangerous

flint birch
#

How do you mean?

thick stag
#

Anyone reading along want to chime in? I'm doing research to follow up on my answer and maybe your power supply is ok?

#

and maybe I'm wrong

#

Sounds like I'm wrong

flint birch
#

OK. I would also make sure to insulate everything properly before powering anything on. Do not want to electrocute myself.

#

How do you actually learn to make animations though? I keep seeing people mention libraries to use, but I don't understand how to get them and then know what they can do?

thick stag
#

Welcome to the art side of things 😄

flint birch
#

Oh boy. Is it easier than the coding side?

thick stag
#

Well you write the code to do the art

flint birch
#

How do you learn the commands or code words to do that?

#

I'm not trying to sound stupid, I just have no idea how to do that or find that.

thick stag
#

depends entirely on what you want to do

#

one moment I'll type out an example

flint birch
thick stag
#

LED_COUNT = 5

# Start LEDS as black
LEDS = [(0,0,0) for i in range(LED_COUNT)]

i = 0
while True: #Run the code forever
    LEDS[i] = (255,255,255) # set one LED to WHITE
    print(LEDS)
    time.sleep(1) # Wait for 1 second
    LEDS[i] = (0, 0, 0) # set one LED to BLACK
    i += 1
    if i == LED_COUNT:
        i = 0```
#

This code will take 5 LEDS, and light one of them up at a time. When it gets to the end of the strand of lights, it starts over again

#

^ This would be a starting point for that first part of the video. And instead of just lighting up one LED you could set the previous led to half brightness and the next led to half brightness

#

and you could get that glowing effect

flint birch
thick stag
#

😄

flint birch
#

Can't it all just be as easy as hello world?

thick stag
#

You can always find code that other people have written but then, your LEDs will only do what they've designed them to do

#

Junior devs ask me, "does it get easier with time?" Well sort of. It's get easy to solve the easy problems but then you start doing harder things 😛

flint birch
thick stag
#

Which if you look at the examples, can do things like "LEDStripRainbow" which sounds like making a wave of rainbow color in your strip

thick stag
flint birch
thick stag
#

If they make the functionality readily available to modify - sure. If you have to dig into their source code to modify things get a bit more difficult

#

Sometimes you'll get code like this: ```from some_led_library_from_some_person import rainbow_leds

rainbow_leds(number_of_leds = 10)```

#

Where literally the only thing you can change is the number_of_leds

flint birch
#

I will steer clear of complicated for now. Maybe in a few lifetimes I would be able to do complicated.

thick stag
#

Hah I started that journey a few years ago. Good luk!

odd fjord
#

just a note -- those are python examples, not Arduino.

thick stag
#

they're psuedocode examples 😛

#

(But jerryn is right)

odd fjord
#

Isn't that what the P in Python is for 😉

thick stag
#

:troll:

#

😄

flint birch
#

Thank you again for all of the help! 🙂

odd fjord
#

Good luck -- This server is a great place to come for help.

shadow marlin
#

If really not confident with programming, consider messing around with Snap as your programming interface. Downside: hard to copy other peoples' code. Upside: no errors because of missing punctuation. https://snap4arduino.rocks/ That instructible looks nice and doable too. I've never used complicated LED stuff like that with snap, so I doubt that's possible.

pallid grail
#

Ok, I'm trying to upload a sketch, and this is the error I'm getting. fork/exec /Users/kattni/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/arm-none-eabi-g++: no such file or directoryNot sure how to go about fixing this.

#

Note I am basically a complete noob with Arduino.

leaden walrus
#

what's the target board? like what Tools->Board is set to

pallid grail
#

QT Py

#

And that's what's connected.

leaden walrus
#

did you install the SAMD board support package?

pallid grail
#

Um....

#

I don't know. I haven't used things in a while.

#

Like through the board manager?

#

I updated the thing in the board manager that added QT Py

leaden walrus
#

Tools->Boards->Boards Manager

#

yep

pallid grail
#

Did that a few minutes ago.

gilded swift
#

Maybe restart Arduino

leaden walrus
#

check both Arduino SAMD and Adafruit SAMD

pallid grail
#

Arduino one is installed too

leaden walrus
#

so you've got both?

pallid grail
#

Restarting didn't work.

pallid grail
#

And they're both up to date.

leaden walrus
#

pop out to a shell and nav to that folder and see what all is there

pallid grail
#

Trying to finish this friggen guide before I'm done for the week, and a screenshot of this sensor working in Arduino is literally the last thing I need. 😖

gilded swift
#

Dang, that’s frustrating

pallid grail
#
arm-none-eabi-addr2line        arm-none-eabi-gcc              arm-none-eabi-gdb              arm-none-eabi-objcopy
arm-none-eabi-ar               arm-none-eabi-gcc-ar           arm-none-eabi-gdb-add-index    arm-none-eabi-objdump
arm-none-eabi-as               arm-none-eabi-gcc-nm           arm-none-eabi-gdb-add-index-py arm-none-eabi-ranlib
arm-none-eabi-c++              arm-none-eabi-gcc-ranlib       arm-none-eabi-gdb-py           arm-none-eabi-readelf
arm-none-eabi-c++filt          arm-none-eabi-gcov             arm-none-eabi-gprof            arm-none-eabi-size
arm-none-eabi-cpp              arm-none-eabi-gcov-dump        arm-none-eabi-ld               arm-none-eabi-strings
arm-none-eabi-elfedit          arm-none-eabi-gcov-tool        arm-none-eabi-nm               arm-none-eabi-strip```
#

so the file is missing apparently.

leaden walrus
#

what dir is that?

pallid grail
#

/Users/kattni/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin

leaden walrus
#
bin$ ls
arm-none-eabi-addr2line  arm-none-eabi-gcc-nm            arm-none-eabi-ld.bfd
arm-none-eabi-ar         arm-none-eabi-gcc-ranlib        arm-none-eabi-nm
arm-none-eabi-as         arm-none-eabi-gcov              arm-none-eabi-objcopy
arm-none-eabi-c++        arm-none-eabi-gcov-dump         arm-none-eabi-objdump
arm-none-eabi-c++filt    arm-none-eabi-gcov-tool         arm-none-eabi-ranlib
arm-none-eabi-cpp        arm-none-eabi-gdb               arm-none-eabi-readelf
arm-none-eabi-elfedit    arm-none-eabi-gdb-add-index     arm-none-eabi-size
arm-none-eabi-g++        arm-none-eabi-gdb-add-index-py  arm-none-eabi-strings
arm-none-eabi-gcc        arm-none-eabi-gdb-py            arm-none-eabi-strip
arm-none-eabi-gcc-9.2.1  arm-none-eabi-gprof
arm-none-eabi-gcc-ar     arm-none-eabi-ld
#

sounds like you only did the SAMD board install a few minutes ago?

pallid grail
#

No, it was installed previously, I updated it a few minutes ago

leaden walrus
#

so you've been able to build for SAMD boards before?

pallid grail
#

as far as I know, yes.

#

But honestly I'm not sure what other boards I've used.

#

Reinstalling the board package

#

removed it and installing it again

#

It's taking ages "Installing tools". Maybe that's a good thing

#

Ok now it's doing something different.

#
Global variables use 609 bytes of dynamic memory.

avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding```
#

Also, interesting, CircuitPython serial output shows up in the serial monitor. TIL.

#

oh

#

it borked which board I was using

#

It worked!

#

Thanks @gilded swift and @leaden walrus. Appreciate the assist.

leaden walrus
#

cool. np.

#

how exactly did you remove it above?

gilded swift
#

🙂

pallid grail
#

I clicked "remove" in the board manager. And then installed it again.

leaden walrus
#

glad that worked 🙂

pallid grail
#

Me too. Oi. Just in time for me to say in the internal meeting that I had it working to finish the guide.

leaden walrus
#

i've seen cases that have required manually deleting that dir

gilded swift
pallid grail
#

Screenshot obtained, and guide is ready for moderation. Whew!

gilded swift
#

🥳

leaden walrus
#

Just In Time Engineering

pallid grail
#

Pretty much.

leaden walrus
#

power outages can cause it too 🙂

eager umbra
#

Hello I have all this parts + a remote somewhere I was wondering if I could make the motor spin with the remote or with some app on the phone

#

Tag me please.

vagrant spade
#

@eager umbra Well what are these parts? If you use a remote (infrared), you need an infrared sensor. If you want to use your phone with bluetooth, you need a Bluetooth module.

#

@eager umbra I think I actually see an Infrared sensor on your Arduino Shield

eager umbra
#

It came with a remote so I assume it has an infrared sensor

#

And I'm not sure but I think the blue thing is bluetooth sensor?

#

So is it possible with the parts I have? @vagrant spade

vagrant spade
#

So then you can probably at least to it with the remote

#

Can you find the part name of the blue thing?

eager umbra
#

Is this it? @vagrant spade

vagrant spade
#

Yes, I think that might be the HC-05 bluetooth module

#

The one to the right is a Full-bridge DC motor driver L298N

eager umbra
#

So, where do I connect each thing? I used to know it all but I completely forgot everything 😬

vagrant spade
#

No worries. There are a lot of tutorials on YouTube and Instructables. Do you want to use the IR sensor or the bluetooth module?

eager umbra
#

I think bluetooth is better

vagrant spade
#

Alright. Then you don't need the Arduino Shield.

#

I would suggest connecting one module at a time to understand how they work. For example start by controlling the motor without the Bluetooth module. Then try just connecting to the bluetooth module, and lastly connect it all together

eager umbra
#

The Arduino shield is the big one?

vagrant spade
#

The arduino shield is the one sitting on top of the arduino

eager umbra
#

Actually there is a small chance the L298N is burned out

#

How can I check that?

vagrant spade
#

Try connecting the L298N as in the tutorial above. If there is no power to the motor, the L298N might be dead

eager umbra
#

Alright

vagrant spade
#

If the motor driver is burned out, you could also use a transistor if you have some other parts

eager umbra
#

What's that?

vagrant spade
#

A transistor is a semiconductor that in your case, you can use as a switch to turn on and of the motor. You can connect one pin of the transistor to the arduino, and then control the current flowing through the transistor (and also the motor)

eager umbra
#

Ok I think the L298N is dead can I use the shield with the IR sensor?

vagrant spade
#

I'm afraid you will need some form of motor driver. Either the L298N or a transistor

#

If you connect the motor directly to the arduino pin, it might draw too much current for the arduino to handle

eager umbra
#

Hmm, I guess I'll have to get a new one then..

teal bane
#

Hi, I'm working on a project using the LC709203F battery fuel gauge module from Adafruit. I got the module working using the example code but my question now as someone with limited knowledge of arduino I'm now trying to figure out how to check multiple of these modules on the same I2C line. The boards all have the same default address which is 0x0B. I'm just kind of stuck on how to best modify the example code and or library in order to chain a couple of these together and monitor multiple batteries. https://learn.adafruit.com/adafruit-lc709203f-lipo-lipoly-battery-monitor/arduino-use

Adafruit Learning System

Keep track of when to charge your batteries!

safe shell
#

@teal bane afaict, there is no ability to change the I2C address, so you'll have to use an I2C multiplexer

leaden walrus
#

^^ yep. i'm also not seeing an alternate address

safe shell
solemn cliff
#

(adafruit stocks it too)

teal bane
#

Alright. I'd been digging around in the datasheet for the chip and looking at adafruits library and it looked like it could be set but it would require changing the library. That multiplexer looks like a much easier solution. Thanks!

split tapir
#

Could anyone recommend a method to read 6 quadrature encoders? (12 signals total)
I'm reading that ISRs are the best method to sense encoder signals, but arduino uno boards only have 2 interrupt pins?
The goal is to get accurate state odometry on a 6 wheeled car

pine bramble
#

Why would you start a complex project using an Uno? ;)

split tapir
#

It was lying around -- just wondering if there are other boards that have more interrupts? or secondary boards that count the encoders separately?

jaunty fox
#

Does anyone know if there is any plan to port ArduinoSound library to nrf52 board(s)? bluefruit sense, specifically

pine bramble
#

@split tapir Since you're here, look at the Grand Central. It's SAMD51. See if it does what you want.
Then you can downgrade your requirements to find a lesser board that matches them. That's approximately how I do it, or I just grab the most complex board I own, in some cases, and do a work-up.

#

I think that ATSAMD51J19A does have internal hardware specific to rotary encoders.

#

Maybe that ItsyBitsyM4 has enough interrupts .. I don't know offhand.

jaunty fox
#

there doesn't seem to be a samd51 board with as many packed-in sensors as the bluefruit sense / arduino nano ble sense

stuck coral
pine bramble
#

Hello everyone! I'm making a servo code and I'm recieving an error which says "expected primary-expression before ";" token" in this code :```

/*
Servo Motor

Move a servo attached to pin 9 so that it's angle matches a potentiometer attached to A0.
*/

int potentiometer = A0;

//include the servo library
#include <Servo.h>
//define a variable 'potPosition' that will store the position of the potentiometer
int potPosition = analogRead(potentiometer);
//define a variable, 'servoPosition', so that the servo will move to this position
int servoPosition = Servo;
//create a servo object
Servo myServo;

void setup() {

myServo.attach(9);

}

void loop() {

//use analog read to measure the position of the potentiometer (0-1023) and store it in potPosition
potPosition = analogRead(potentiometer);

servoPosition = map(potPosition, 0, 1023, 20, 160); //convert the potentiometer number to a servo position from 20-160
//Note: its best to avoid driving the little SIK servos all the
//way to 0 or 180 degrees it can cause the motor to jitter, which is bad for the servo.

//move the servo to the degree position determined by servoPosition
myServo.write(servoPosition);
}

shadow marlin
#

The line int servoPosition = Servo looks suspicious to me, since two lines later Servo is used as a class.

#

Use pastebin or github gist to post your big code. Include a copy and paste of the error message to get better help.

pine bramble
#

What do you mean by it looking suspicious?

#

Oh do I set it as 0 to read to positioning?

shadow marlin
#

What value do you think Servo has on line 14? It's a syntax error to assign a class to an int.

#

Do you have a guide you are following? Check it or the docs for exactly how to tell a Servo what pins to use to control the servo.

pine bramble
#

I shouldn't have set it to Servo, that was my fault. It's meant to be used to read the values for potPosition so I believe it has to be set to 0, right?

shadow marlin
#

Any value will be fine.

pine bramble
#

Even after replacing that value, the potentiometer doesn't seem to be in sync with the servo motor

shadow marlin
#

Next step is to calibrate it.

#

Find the lowest reading your potentiometer gives, make that the bottom of the map range.

#

Highest -> top of map.

#

Or whatever positions of the pot you want to actively control the servo.

pine bramble
#

as in " servoPosition = map(potPosition, 0, 1023, 20, 160); " ?

elder hare
#

this is my smoke machine controller 😛 LED lights up when the smoke machine is warm enough and ready to put out smoke and the other is a push button to yea... release smoke! how would i connect this to my ESP32 to be able to "push the button" to put out smoke and also detect when the smoke machine is ready (the LED wires)?

flint birch
#

Hi. Would someone be able to help me set up an Organizer ESP8266 ESP-12 to work with arduino? I am trying to follow the tutorial below but I am not able to get the test code to work.

https://www.instructables.com/Programming-the-ESP8266-12E-using-Arduino-software/

Instructables

Programming the ESP8266-12E Using Arduino Software/IDE: The ESP8266 is like an Arduino with a builtin WiFi, the MCU and WiFi circuitry are in the same chip. Consider Arduino + WiFi Shield = ESP8266. In this instructable I will provide a step by step guide to procure and programming an ESP8266-12E WIFI De…

elder hare
shadow marlin
#

@flint birch You should provide more details about how far you got and concrete evidence of what the problem is. Pastebin.com or a github gist to share code/errors is the way to go. Screenshots if that's what the issue is. If no errors, what have you done to diagnose the problem. It's annoyingly detailed engineering until you get off the ground.

flint birch
#

OK. One second.

#

I am brand new to programming so I will be very ignorant, but I am trying to learn.

#

This is the error that I am getting when trying to upload that sample code.

Executable segment sizes:
IROM : 228640 - code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 26756 / 32768 - code in IRAM (ICACHE_RAM_ATTR, ISRs...)
DATA : 1248 ) - initialized variables (global, static) in RAM/HEAP
RODATA : 688 ) / 81920 - constants (global, static) in RAM/HEAP
BSS : 24880 ) - zeroed variables (global, static) in RAM/HEAP
Sketch uses 257332 bytes (24%) of program storage space. Maximum is 1044464 bytes.
Global variables use 26816 bytes (32%) of dynamic memory, leaving 55104 bytes for local variables. Maximum is 81920 bytes.
An error occurred while uploading the sketch
esptool.py v2.8
Serial port COM4
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 3c:61:05:cf:f7:db
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 261488 bytes to 193158...
Wrote 261488 bytes (193158 compressed) at 0x00000000 in 17.0 seconds (effective 122.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

#

Is this what you need? It is what appears at the bottom of the arduino screen.

shadow marlin
#

That is not what I expected to see. It appears successful. (Good all the way to "Hash of data verified"). I think you'll need someone with more experience than me.

Google the error "Leaving... Hard resetting via RTS pin... ESP8266". There's plenty of writeups about it.

#

You don't say what sketch you're running, but hopefully it is something like blink so it's obvious if/when it does actually work.

flint birch
# shadow marlin You don't say what sketch you're running, but hopefully it is something like bli...

Yes. This is the example code that was given.

const short int BUILTIN_LED1 = 2; //GPIO2
const short int BUILTIN_LED2 = 16;//GPIO16

void setup() {

pinMode(BUILTIN_LED1, OUTPUT); // Initialize the BUILTIN_LED1 pin as an output
pinMode(BUILTIN_LED2, OUTPUT); // Initialize the BUILTIN_LED2 pin as an output

}

void loop() {

digitalWrite(BUILTIN_LED1, LOW); // Turn the LED ON by making the voltage LOW digitalWrite(BUILTIN_LED2, HIGH); // Turn the LED off by making the voltage HIGH delay(1000); // Wait for a second
digitalWrite(BUILTIN_LED1, HIGH); // Turn the LED off by making the voltage HIGH
digitalWrite(BUILTIN_LED2, LOW); // Turn the LED ON by making the voltage LOW
delay(2000); // Wait for two seconds

}

flint birch
shadow marlin
#
if you put code enclosed in triple back-ticks it looks nicer
flint birch
shadow marlin
#

In the upper left corner of the keyboard there is this: `

#

Putting one around your code make it look monospace

#

Putting three on a line by themselves starts&ends a block of monospace.

night portal
#

hey guys, I'm having an interesting issue with neopixels and I'm wondering if anyone else has encountered it. I have my code set to fill 40 neopixels with white light, but it's fluctuating between colors even though I'm using two commands, fill() and show(). does anyone know why this might be happening? thanks

solemn cliff
shadow marlin
#

duncanj did the basic demo work? what kind of troubleshooting have you done? does 1 pixel work as expected? 2? post the code in a pastebin if you have a working demo

native kelp
#

im looking at digitalRead documentation and it5 5aying ```Notes and Warnings

If the pin isn’t connected to anything, digitalRead() can return either HIGH or LOW (and this can change randomly).

The analog input pins can be used as digital pins, referred to as A0, A1, etc. The exception is the Arduino Nano, Pro Mini, and Mini’s A6 and A7 pins, which can only be used as analog inputs.

#

doe5 it mean that

#

fi the pin i5nt connectedd to anything phy5ical

#

like a real pin

#

or doe5 it mean that if the pin i5nt connected to neither ground nor live

#

doing te5ting it would 5eem that it5 the fir5t ca5e

night portal
# shadow marlin duncanj did the basic demo work? what kind of troubleshooting have you done? doe...

I'll try to explain as brief as possible, then I'll post the relevant code that I'm using. I've used neopixels before and have been able to get them up and running okay. I'm using 2 rings, 24, and 16. I can get the basic code to work, but not all 40 neopixels illuminate. I checked the soldering I did and it looks completely fine. It seems to be something with the for loop, like it lights up the individual r g b pixels, so the count finishes before illuminating the whole ring. if I boost the number of pixels up, it works

#

maybe pixels.clear() is messing me up when it comes to fluctuating colors

#

?

shadow marlin
night portal
#

thanks, I'll give it a go

shadow marlin
#

key part of description

if I boost the number of pixels up, it works

night portal
#

yeah it's a really strange issue. A few months ago I used two rings and a gemma m0 to backlight a lithophane fine, but with low brightness to limit the current draw. Now I'm using a 5V 10A and I'm getting fluctuations in colors even though I'm using pixels.fill(16777215,0,numpixels); at 75% brightness. So strange to me.

shadow marlin
#

same issues with just one ring, or no?

night portal
#

yeah if I define numpixels as 24, not all 24 light up. you think this could be due to my mistake of not putting a resistor between micro and data input for the rings?

solemn cliff
#

can you light individual pixels ? like if you just try to light the 40th what happens ?

night portal
#

one sec, let me upload code for that

shadow marlin
#

yeah, we think you need to work on isolating the problem. right now u haven't even figured out if it's hardware or code. very simple code should make it easier to blame/not blame that part

#

simplify hardware setup too, if you can detach some stuff physically

night portal
#

I would agree, I'm going to splice in a resistor really quick and see what that does

shadow marlin
#

you're guessing. simplify first. unless you're lucky

green heath
#

Is it possible that my serial transmit code interferes with my digital direct synthesis. I am getting distortion when I transmit the the pwm registers value to plot it. and its a clean signal without any transmission.

#

I can see the distortion as well on the plot. but I cant explain it

#
{
        OCR2B = 128+My_DDS.pwmvalue;
}

ISR (TIMER2_COMPA_vect)
{
        My_DDS.accumulator_steps = 1760;
        My_DDS.accumulator += My_DDS.accumulator_steps;
        My_DDS.step = (My_DDS.accumulator >> 8);
        My_DDS.pwmvalue = fullSine[My_DDS.step];
}```
#
{
    loop_until_bit_is_set(UCSR0A, UDRE0);
    UDR0 = byte;

}
night portal
green heath
#

I really can't explain why it oscillates so much

#

Could the fluctuations be because i am transmitting slower than the interrupt? 9600 baud vs 8bit timer with no prescaler

#

On a f_cpu of 16mhz

pine bramble
#

@native kelp >> If the pin isn’t connected to anything..<<

I take that to mean they're telling you not to let the pin float if using digitalRead() on it.

#

(as opposed to, say, not letting any pin float - just that one pin) (perhaps)

#

That's their way of saying use a pullup (or a pull-down) resistor, I think.

native kelp
#

okay then

pine bramble
#
pinMode(pin, INPUT);           // set pin to input
digitalWrite(pin, HIGH);       // turn on pullup resistors
#

Since you're pulling up to Vcc, you ground it to register a pushbutton press.

#

Then, a finite (and very reasonable) current flows through your switch (to ground).

#

Try INPUT_PULLUP instead of PULLUP .. initially. See if it meets your needs.

#

(I don't know the differences, if any)

#

I think the above code block applies the most to a programming system that does not feature INPUT_PULLUP but I could be mistaken.

#

(Like maybe an AVR BSP?)

native kelp
#

well i didnt really encounter anything weird happening to the pin reading while i wa5 doing my 5mall te5ting, but i'll keep that in mind

night portal
#

@shadow marlin pretty sure I figured it out. Seems to have been an issue with my code. I overlooked adding NEO_RGBW instead of NEO_RGB. Now all LEDs light when defined, and don't fluctuate color.

shadow marlin
#

Glad to hear it.

proud mountain
#

I'm unable to flash my esp32 arduino. When it tries to connect, the 'timed out waiting for packet header' error occurs. If I connect gpio0 to gnd, and press the reset button (only button on the board), I get this output in the terminal:

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0xb (HSPI_FLASH_BOOT)
flash read err, 1000
ets_main.c 371

I am not sure what to do next. Any help would be appreciated.

visual spire
#

On the Feather M4, several pins share the same interrupt number, according to the pinout diagram. Does this mean that if I enable interrupts on one pin, would another pin that shares that same interrupt number going HIGH/LOW trigger that interrupt?

visual spire
#

I think I figured out my issue. I am using the SAMD51 on a custom PCB with the Adafruit bootloader and board definitions. On this board, I need digital pin 8 to be an interrupt, which is used for the neopixel on the Feather board. I thought this was possible, as it says there is an interrupt on that pin in the pinout diagram. However in the variant.h, it says there isn't an interrupt on this pin.

{ PORTB, 3, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, //neopix

Is there any way I can assign an interrupt to this pin?

gilded swift
#

Change the variant.h file

visual spire
# gilded swift Change the variant.h file

Do I need to do anything else? I can just replace EXTERNAL_INT_NONE with EXTERNAL_INT_3 (the corresponding interrupt for the pin in the pinout diagram) and it should work?

gilded swift
#

Eh.. interrupts use timers

#

I would think if you removed timers and external int you would be fine

visual spire
#

Some of the other interrupt enabled pins don't seem to have timers

  { PORTA,  2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 },
  { PORTA,  5, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 },
gilded swift
#

Or copy what’s there

visual spire
#

What do you mean by "removed timers"?

gilded swift
#

Probably safer to just copy what they have

pine bramble
#

D9 PA19 is also I3

gilded swift
#

I’m used to setting up timers with ISRs

pine bramble
#

So you have to disable the interrupt I3 on PA19 to use it on PB03.

gilded swift
#

It’s a more low level C thing than an Arduino thing

gilded swift
#

Yeah also what @pine bramble mentioned

pine bramble
#

variant.cpp iirc

visual spire
#

Ok... this is easier than I expected. Thanks!

pine bramble
#

Should be fine but let us know. ;)

#

After seeing all this the datasheet would probably give more insight.

#

I'd rather address the code problem, then look at the datasheet as a sanity check, than the other way around. ;)

#

Also there's some deep hardware stuff in Atmel Start projects that shed light on all of this.

#
bitbanged-serial-a/include/pio
 $   ag EXTINT3 samd51j19a.h | cat
286:#define PIN_PA03A_EIC_EXTINT3           _L_(3) /**< \brief EIC signal: EXTINT3 on PA03 mux A */
287:#define MUX_PA03A_EIC_EXTINT3           _L_(0)
288:#define PINMUX_PA03A_EIC_EXTINT3   ((PIN_PA03A_EIC_EXTINT3 << 16) | MUX_PA03A_EIC_EXTINT3)
289:#define PORT_PA03A_EIC_EXTINT3  (_UL_(1) <<  3)
291:#define PIN_PA19A_EIC_EXTINT3          _L_(19) /**< \brief EIC signal: EXTINT3 on PA19 mux A */
292:#define MUX_PA19A_EIC_EXTINT3           _L_(0)
293:#define PINMUX_PA19A_EIC_EXTINT3   ((PIN_PA19A_EIC_EXTINT3 << 16) | MUX_PA19A_EIC_EXTINT3)
294:#define PORT_PA19A_EIC_EXTINT3  (_UL_(1) << 19)
296:#define PIN_PB03A_EIC_EXTINT3          _L_(35) /**< \brief EIC signal: EXTINT3 on PB03 mux A */
297:#define MUX_PB03A_EIC_EXTINT3           _L_(0)
298:#define PINMUX_PB03A_EIC_EXTINT3   ((PIN_PB03A_EIC_EXTINT3 << 16) | MUX_PB03A_EIC_EXTINT3)
299:#define PORT_PB03A_EIC_EXTINT3  (_UL_(1) <<  3)
 $ 
#

from:

#

I assumed ATSAMD51J19A but I did not look it up!

sleek knot
#

So I'm useing an attiny to blink an RGB-led.
and blink red if the batt is low, yellow if its getting low and GREEN if the battery is fine.
I am doing the sencing through pin 2 connected directly to the battery.

NA    1-[*  ]-8 VCC+ 
Bat+  2-[   ]-7 RED led
NA    3-[   ]-6 GREEN led
GND   4-[   ]-5 BLUE led

This is the basic pin-out currently.
however the attiny will not power off when I unhook VCC. Because it is pulling the power from the batt through pin 2.
Any ideas?

pine bramble
#

Use a voltage divider, maybe.

#

That way the voltage on pin 2 isn't high enough to power the microcontroller core.

visual spire
#

Thanks guys, I changed what you suggested and it worked perfectly!

pine bramble
#

sweet .. good deal, MaxThe

gilded swift
#

Great to hear

native kelp
#

I see common written on the datasheet for an encoder, whay does it mean?

native kelp
#

Nvm

pine bramble
#

;)

glacial spire
#

I am trying to make 3 ledstrips be controlled by one adruino UNO. This is possible right? because I cannot seem to get it working.

#

Do I define my ledstrips like this

Adafruit_NeoPixel strip1(NUMPIXELS, 4, NEO_RGBW + NEO_KHZ800);
Adafruit_NeoPixel strip2(NUMPIXELS, 5, NEO_RGBW + NEO_KHZ800);
Adafruit_NeoPixel strip3(NUMPIXELS, 6, NEO_RGBW + NEO_KHZ800);
pine bramble
#

@glacial spire Start with just a few LEDs on each strip - not the entire strip, in your programming.

#

The software has no 'idea' it's talking to a very long strip.

#

The strip will behave as a shorter strip if you program it to.

#

If you can manipulate, say, 4 RGB's per strip on all three, then you've proven the electrical connections.

#

Don't try anything with DMA as I think that needs special hardware support.

glacial spire
#

I have electrical connection problems.

pine bramble
#

That'll do it. ;)

glacial spire
#

I connected all the strips to one pin now. Just to 6

#

Only 1 ledstrip actually reacts.

pine bramble
#

You can connect them in series (for data transfer) but not in parallel.

#

so the end of one strip feeds the start of the next strip (that's what series means, here).

#

You can also swap out strips to test each individually, to ensure you have, in fact, three good strips that'll function correctly when everything else is correct.

glacial spire
#

is it possible that a strip is broken?

#

Or is it only the connection that can be

pine bramble
#

A lot of beginners will jump to the conclusion their stuff is broken, when it's not.

glacial spire
#

I know and I am a beginner. But I am just trying to find an explination why it could not work.

pine bramble
#

The easiest way forward is to start with known good hardware, get it working, then swap out parts.

#

I do my best to have 2 or 3 examples of anything that's apt to be puzzling.

#

For the Uno you can prove a lot just by for example connecting an LED to the same pin you wanted to connect an RGB strip to. Use a current limiting resistor (about 1k is fine).

#

If it will blink that LED the chances are excellent it will also control your RGB strip successfully.

native kelp
#

one of my pin5 when being read with digitalread give5 me completely garbled data

#

not even 1 or 0

#

what could be the cau5e of that?

#

actually

#

nvm

lone lantern
#

Random question, for the Circuit Playground Express, what would be the easiest way to mirror the state of the IR receiver to an external pin? (e.g. for connecting to a scope)
edit: I just ended up going the lazy route and using an interrupt

night portal
#

this is a diagram of a setup I have connecting a QT PY to a neopixel. does anyone know why it works with separate power supplies, but not when using a splitter connected to a 5V 10A supply to power both the neopixels and QT PY? btw the way, I also have a pump getting triggered by A3 and it works completely fine when using a splitter. it's only the neopixels that are having a problem

north stream
#

You need a shared voltage reference

night portal
#

@north stream they both are connected to the same surge protector in the end. My desktop shares a surge protector with the 5V 10A supply

#

but if I use a splitter from the 5V 10A to both the rail powering the neopixel, and the qt py, shouldn't it work? or is that where you're saying I should have a shared reference?

north stream
#

Yes, the LEDs and the controller need a reference, not just one wire can make a circuit

#

You just need to tie the 0V from the controller to the 0V on the LEDs

night portal
#

by 0V you mean the ground? sorry i'm a noob with this terminology

night portal
#

@north stream also what’s weird tho is that the dc pump which is triggered by the qt py is working with both configurations, it’s just the LEDs that are acting strange

north stream
#

I'm unsure how the pump is connected. Many people call 0V "ground", but it's technically a misnomer

night portal
#

@north stream just like the neopixels, I have a 3.3V buck converter connected to the vertical rails on the board. Then using a transistor, I have A3 going to the gate, the collector goes to the red wire on the pump, and the pumps black wire goes back to the ground on the vertical rails

north stream
#

Hmm. Your schematic doesn't show those connections.

night portal
#

@north stream it was a simplified schematic because as far as I can tell, everything works in either configuration except the neopixels. I could draw up a more in-depth one though of the entire circuit

flint birch
#

Could someone help me test if my ESP12 and LEDs are working with some simple code for an arduino? I've been trying the blink command but I cant get anything to light up. Fair warning, I am a complete beginner at this.

thick stag
#

Got a photo of your circuit and can you share your code?

flint birch
#

Yes. One second.

#

Code:


// How many leds in your strip?
#define NUM_LEDS 1

// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN.  For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 6
#define CLOCK_PIN 13

// Define the array of leds
CRGB leds[NUM_LEDS];

void setup() { 
      // Uncomment/edit one of the following lines for your leds arrangement.
      // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
      FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
      // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS);
      
      // FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);

      // FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
}

void loop() { 
  // Turn the LED on, then pause
  leds[0] = CRGB::Red;
  FastLED.show();
  delay(500);
  // Now turn the LED off, then pause
  leds[0] = CRGB::Black;
  FastLED.show();
  delay(500);
}```
#

This was example code I found.

night portal
#

@north stream this is the entire circuit. What happens is that if I use a splitter on that power brick and then use it to power what it does in the picture, and then also the qtpy, the LEDs stop working, but the pump continues to respond to the changes observed in the soil sensor. The fact that the pump still works in conjunction with the soil sensor makes me think there is already a shared reference voltage

solemn star
# night portal <@348911944486486016> this is the entire circuit. What happens is that if I use ...

By that circuit the side with the power brick is not sharing a ground connection with the QTPY. Going back through devices to the surge protector doesn't work as a common ground. Generally speaking ground connections in electronics circuits have to share a common ground (sometimes call zero volt ground among other things). Voltage is relative to ground. Having two parts of a circuit on isolated grounds can cause issues. There are times where this isn't true, but I don't think this is one of them. Having isolated grounds may cause unexpected results, or even some good old blue smoke, in some circuits.

night portal
#

The situation where it doesn’t work, is this one @solemn star wouldn't using the splitter require them to share a common ground? If so, why does this case not work, but the one where they don't share, does?

solemn star
#

Let me look further at it. I appologize, completely misread what you had said earlier.

night portal
#

No need to apologize @solemn star it's complicated for me to convey what I'm saying in only text, I didn't want to feel like I was spamming images

shadow marlin
#

@flint birch Can you verify that your breadboard is making the connections that you expect it to? (Multimeter or something?) The ones I have that look like that are connected "horizontally".Your breadboard might connect the two leads from the capacitor and not the red wires together.

solemn star
#

I'm not actually sure why the neopixels are working in either case. The microcontroller doesn't seem to have a common ground connection to the neopixels in either scenario. But maybe I'm missing something and someone else on this board will see it. I'm not familiar enough with the QTPY to know if the usb ground is common with the ground pin on the QTPY.

night portal
#

@solemn star even in the second configuration where they share the same power supply? When it’s plugged in like that, I can use a multimeter to measure 5V between the proto board rail and the qtpy ground pin

winter ridge
#

I'm trying to setup serial comms between an arduino and python, so I can control some NeoPixels. I've got this code I mostly copied from a post on the arduino forums, that's not working. I think the problem is that newData never gets set to true, but I'm not 100% sure.

Arduino code: https://pastebin.com/JT9WRHES
Python code: https://pastebin.com/nNrw3sMQ

reef ravine
#

@winter ridge it looks like the python code never sends the start or end markers

winter ridge
dusk imp
#

With a loop!

wispy crater
#

Hello everyone!
i am making a project with a sim900a gsm module. i am using the following code:-

 
 #include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);

void setup()
{
  mySerial.begin(9600);   // Setting the baud rate of GSM Module  
  Serial.begin(9600);    // Setting the baud rate of Serial Monitor (Arduino)
  delay(100);
}


void loop()
{
  if (Serial.available()>0)
   switch(Serial.read())
  {
    case 's':
    delay(1000);
      mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
     delay(1000);  // Delay of 1 second
     mySerial.println("AT+CMGS=\"+91xxxxxxxxxx\"\r"); // Replace x with mobile number
     delay(1000);
     mySerial.println("Hello World");// The SMS text you want to send
     delay(1000);
     mySerial.println((char)26);// ASCII code of CTRL+Z for saying the end of sms to  the module 
     delay(1000);
     break;



      
    case 'r':
      mySerial.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS
      delay(1000);
      break;
  }

 if (mySerial.available()>0)
   Serial.write(mySerial.read());
}```


so when i run it, i have to send "s" in the serial port 
but when i send it, the following message is showing:-
```AT+CMGF=1

OK
AT+CMGS="+91xxxxxxxxxx"


> Hello World

>```

the problem is that the message is not sent in the destination number

I want help with this!
Thanks in advance
north stream
#

Looks like it's doing the right thing, I'm not sure what you want to change. Presumably the module is echoing the commands you send it, then your loop is returning them

wispy crater
north stream
#

Hmm, I wonder if you need to set the service center address or it doesn't like the delay. Normally I just use the FONA library instead of sending the commands directly.

wispy crater
#

oh

#

do you have any example code?

#

it would be really helpful

stuck coral
wispy crater
#

okay thank you so much guys

#
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00
An error occurred while uploading the sketch

what is this error?

north stream
#

It's trying to talk to the bootloader to install some code, but isn't getting the response it's expecting

wispy crater
#

oka

wispy crater
#

can anyone tell me what can i do if my 16*2 i2c lcd is not displaying any text ,instead, a single black line on the upper row

thick stag
#

Check your wires and check your code

#

(it's most likely your wiring or breadboard)

wispy crater
#
LiquidCrystal_I2C lcd(0x27,16,2);

void setup() {
    lcd.begin(16,2);
    lcd.backlight();
    lcd.clear();
    lcd.print("yay");
}

void loop() {
    
}
#

here is the code

#

and i have already resoldered the lcd multiple times today

thick stag
#

Did it work on the breadboard before you soldered it?

#

also photos of your setup?

wispy crater
#

yeah sure

#

just a min

#

here it is @thick stag

#

a simple setup with 4 wires

#

but is is not displaying anything

thick stag
#

I need a photo of the wires

wispy crater
#

just a black line

#

ohk

thick stag
#

your wires are most likely not setup correctly

#

no need to solder anything to the arduino itself

wispy crater
#

yeah i didn't

thick stag
#

You said you resoldered multiple times? I'm not sure what you're referring to

wispy crater
#

I resoldered the i2c to the lcd multiple times

thick stag
wispy crater
thick stag
#

The photo I need is to be able to follow each of the wires from the arduino to the lcd

#

or you can draw it out in mspaint or something

wispy crater
#

pic is uploading please wait

#

this is the wiring

thick stag
#

got a better photo I can't tell where each wire goes

wispy crater
#

oof

#

wait

#

finally

thick stag
#

Have you tried sticking a screw driver to the blue box?

wispy crater
#

yup

thick stag
#

and rotating all the way left and right

wispy crater
#

yes

#

it increases something of the displayed thing which makes it more visible

visual spire
#

I have this software problem that I have been trying to fix.

I can do this and buff will contain the correct telemetry data locally:

bool VehicleTelemetry::receiveTelemetry(uint8_t telem[], uint8_t len) {
  uint8_t buff[235];
  uint8_t size = sizeof(buff);
  if (!_loraDriver->recv(buff, &size)) {
    return false;
  } else {
    for(int i=0; i<sizeof(buff); i++){
      printHex(buff[i]);
    }
  }

  return true;
}

But whenever I pass in an array to receiveTelemetry and try to read the data into there it doesn't work (runtime not compile error). telem does not contain the data when I read locally or outside the function. Does anyone know why? I imagine it has to do something with pointers.

bool VehicleTelemetry::receiveTelemetry(uint8_t telem[], uint8_t len) {
  if (!_loraDriver->recv(telem, &len)) {
    return false;
  } else {
    for(int i=0; i<len; i++){
      printHex(telem[i]);
    }
  }

  return true;
}
thick stag
#

What does the Serial monitor say

wispy crater
#

this thing

thick stag
#

Mayhaps you have a bad device or there was an error with soldering

wispy crater
#

hmm

#

okay...

thick stag
#

Could try replacing all the jumper wires

wispy crater
#

ok

#

hey

#

using <LiquidCrystal_PCF8574.h> library

#

it is working fine

thick stag
#

🤷‍♂️ lol

wispy crater
#

hehehe

#

idk how

#

but it worked

thick stag
#

Welcome to aruino.

wispy crater
#

yes!

#

thank you

thick stag
#

lol good luck

wispy crater
#

😁

shadow marlin
# visual spire I have this software problem that I have been trying to fix. I can do this and ...

You aren't showing the problem part of the code.
You need to show a short example that does not work.
You should also include the error that you get when it fails. And what line the error is on, if you can figure that out (presumably in the recv call, but you need to make sure of that).
Otherwise we're just guessing. But I will guess that you have not actually allocated space for telem in the caller, and you get a segfault.

visual spire
#

I understand, I’ll get you an example program

visual spire
#

@shadow marlin Here is the example program. I was able to reproduce the issue with it. Many more details about error and install at top of main file. Thanks for taking a look!

shadow marlin
#

next time dump it to pastebin or a github gist so people can read it without downloading

visual spire
#

putting it into gh now

shadow marlin
#

i don't see the error i was expecting to see. can you move the declaration of serializedTelem into the loop and see if that makes any difference?

visual spire
#

oh dang it does!

#

it works now

shadow marlin
#

global vs local weirdness

#

hope that's enough for you to go again.
if you need that variable to be global you could allocate it in the setup() and it would probably still work, using new uint8_t[235] or whatever they say in C++

visual spire
#

@shadow marlin Thanks so much! So like make a pointer in global and allocate it using that in setup()?

shadow marlin
#

That was actually an interesting problem... surprise!

slim shell
#

Whats a decent bluetooth module that I can use with my phone ? I want to make a remote car or claw or something

visual spire
#

Ok, thanks for clarifying. In my actual program I’m reading it into a struct using a union, and then using that struct across my program. Sorry to bother you again, but do you know any way to do that with these constraints?

visual spire
#

I can probably do the same thing, only with the union, nevermind

pliant tusk
#

I'v an Adafruit Feather Bluefruit Sense that I'm trying to use the HID-Project example Gamepad. The compile fails with fatal error:: HID.H: No such file or directory I've been going nuts trying to find the missing module. Any suggestions on where to find it?

north stream
#

I think that would be part of the board package or its dependencies.

night portal
#

Does anyone know why neopixels would only work in a circuit when not sharing a common ground with the microcontroller?

visual spire
# shadow marlin Yes

I tried that, but it didn't work. Won't the memory allocated in setup() be freed once that function ends?

night portal
#

BREAKTHROUGH! (not that anyone asked) but I've been posting about an issue with my circuit not lighting my neopixels when connected to a single power supply that would provide power to the qtpy, LEDs, and pump, soil sensor, and rtc. It seems that the issue was all because of the 330ohm resistor I had connecting A2 to the data pin of the LEDs. Not really sure why this is the case, but I posted the schematic a couple days ago if you want to scroll up and check it out.

north stream
#

Cool, I was curious, thanks for letting us know!

shadow marlin
# visual spire I tried that, but it didn't work. Won't the memory allocated in `setup()` be fre...

Dynamically allocated memory is not freed until you do it explicitly. Your function would segfault if the memory were deallocated. Assuming when you say "I tried that" you mean you dynamically allocated memory and put it in a global variable and it didn't get changed by the recv routine. If that is the case, try the same experiment with a local variable & dynamically allocated memory... something very weird happens, if you don't want to hack around you'll need to find somebody who really knows the guts of how the language works.

visual spire
#

Ok, thanks

night portal
north stream
#

We all start out as beginners

wispy crater
#

hello everyone, i am not able to send message through a "sim900a gsm module"
the code is:-

{
  delay(1000);
  Serial.begin(9600);
  Serial.println("AT+CMGF=1");
  delay(1000);
  Serial.println("AT+CMGS=\"+91xxxxxxxxxx\"\r"); //replace x by your number
  delay(1000);
  Serial.println("hello");
  delay(100);
  Serial.println((char)26);
  delay(1000);
}
void loop()
{

}```
it doesn't even shows any error
please help!
thanks
stuck coral
wispy crater
#

there is no error

#

but the message is not sent to the destination

stuck coral
wispy crater
#

yeah it doesn't

wispy crater
stuck coral
#

Sure, but if you dont print an error, how can you say there are no errors? I would add code to your loop that lets you view the responses from the SIM900 module

wispy crater
#

okay

#

what should i add in the code to see the error?

stuck coral
#

Which board are you using?

wispy crater
#

arduino uno

stuck coral
#

This will let you manually send AT commands from your computer and let you see the response from the arduino serial console

wispy crater
#

okay!

#

let me try

stuck coral
#

Note that will require you to change the RX TX lines from the hardware serial port to a software serial port as the hardware serial port is used for the connection to the computer

wispy crater
stuck coral
#

Pin 3 would be the Arduino's RX so your module TX, and pin 2 would be the Arduino TX or your modules RX

wispy crater
#

okay

stuck coral
wispy crater
#

okay so, when i am sending the command "AT" it is not responding

stuck coral
#

Okay one moment sorry, brb

wispy crater
#

umm

stuck coral
# wispy crater umm

Okay sorry, was in a meeting. If you dont get an OK back then you have a hardware issue of some sort

#

Does your SIM900 module have a power LED?

wispy crater
#

yes

stuck coral
#

And its on correct?

wispy crater
#

yes

stuck coral
#

Im looking at the datasheet for that module, are you sending "AT" or "at"?

wispy crater
#

both

stuck coral
#

Okay, if you change your serial port to the module from 9600 baud to 115200, then while looking at the arduino serial console you unplug the power for the SIM900, then plug it back in, do you see the hex string 0 49 49 49 49 FF FF FF FF?

wispy crater
#

let me check

stuck coral
#

Following that string should also be "RDY" on another line a few seconds after

stuck coral
#

Hm, could I please see your wiring?

wispy crater
#

umm

#

actually i am on my pc and its mid-night so my parents will not let me open the phone😅

#

i can show you the schematic

stuck coral
#

Fair enough, I doubt the issue is to do with the schematic, but you could send if you want. But I can say your issue is with the connections/hardware, not your arduino and software

#

Which even if we dont solve that tonight, that gives you a solid direction and a place to start if you need help when you can take a photo