#help-with-arduino

1 messages · Page 25 of 1

fervent tartan
#

stm32f
422CEU6

#

GQ28U159R
CHNGQ 150

#

4.3V on VDD_3 it appears I also have very cheap dmm

#

VDD_2 same measure VDD_! 0v?

#

VDDA also 0

#

I got two soldered them onto a board and then had issues. didn't test first. The fact they both behave the same leads me to think cheap micros no bootloader. But then the voltages i have seen makes me think borked.

#

But I haven't desoldered the other MCU yet

stable forge
#

VDD (supplied to all the VDD pins) should be between 1.65 and 3.6v. It sounds like the board is very messed up.

amber patrol
#

im not too familure with how to do this like what resistors would i need irf any andwhat gpio would i use

stable forge
#

A0 and A1 are open. If you want to close A0 and leave A1 open, add some solder that bridges the ">" gap that's marked "A0"

#

A0 and A1 open are address 0x49. A0 closed and A1 open is 0x4A, etc.

amber patrol
#

Oh gotcha

tired kite
#

Looking for some help with playing audio using ESP32-audioI2S library. Pretty sure I have everything wired up correctly. I'm getting a few seconds of static hiss from the speakers, and then nothing else. I'm using the Adafruit ESP32-S3 QT Py, MicroSD card breakout board+ (254), and uda1334a dac. I've already verified the sd card breakout board is wired correctly and can read/write to the sd card. The DAC is the new addition to the equation I'm trying to get working.

tired kite
#

I added the function my_audio_info to try and get some more data on what is happening. Serial output is:

info: File-Size: 1723202
info: file has no ID3 tag, skip metadata
info: Audio-Data-Start: 3
info: Audio-Length: 1723199
info: stream ready
info: Closing audio file "audio.mp3"
info: MP3Decoder has been destroyed
eof: audio.mp3```
#

right at info: stream ready is where i get a few seconds of static. Then is closes the audio file after that.

inland gorge
# tired kite I added the function my_audio_info to try and get some more data on what is happ...

Exactly which version of the ESP32-S3 QTPy do you have? That library says it requires PSRAM and there are two flavors of the ESP32-S3 QTPy: one with 2MB PSRAM and one without https://www.adafruit.com/product/5700 https://www.adafruit.com/product/5426

tired kite
tired kite
#

Excellent idea. This is actually the very first thing I did before I loaded any code onto the board. Is there any reason to attempt this a second time?

#

I may actually call this fine for now since my project won't be using an SD card module, it was just a means to verify the DAC worked as expected. Ultimately I'm trying to get full duplex audio working.

stable forge
tired kite
#

I had to double check, but I indeed reinstalled the UF2 bootloader before I started loading code onto the board. I followed the instructions on this page for esptool.py, and used the 2.8MB single partition bootloader for the 2MB PSRAM board.

#

I'm on a mac. OS is Sonoma 14.8.3

plain dirge
#

Hi there. I'm trying to upgrade my Beatseqr hardware music sequencer from an Ardiuno Mega to a Grand Central M4 Express. Things are going ok, except for one tricky issue I can't seem to research my way out of so far. I have an LCD Serial controller connected to pin 69/A15 which, research leads me to believe is connected to the SERCOM6 module. Is there any way on the SAMD board to reassign pin 69/A15 to be able to do UART/TX ? I just need to send serial, I don't need to receive.

#

for additional context, I was using SoftwareSerial with the Arduino Mega, and I can't do that with the SAMD board

stable forge
#

Click on the diagram to get a full-sized version.

#

does that match with the pin you think it is?

vivid rock
#

Dear all:
I seem to have trouble with the latest batch of adafruit's ESP32-S3 QTPy (no PSRAM): https://www.adafruit.com/product/5426

I have been using these for several years in my projects, and love them. Recently - maybe 3 weeks ago - I received a new batch, and this is where the trouble started.

WiFi stopped working. I tested my old code, which worked fine before; then I tested the examples included with esp32 WiFi library, such as "WiFi access point", changing nothing but ssid and password.

The code runs, prints

Configuring access point...
AP IP address: 192.168.4.1
Server started

to serial monitor.
However, most of the time neither my laptop nor my cell phone sees the created network, and if it does see it, it can't connect - and after attempting to connect, network disappears from the network list.

Nothing is printed to serial monitor (it is supposed to print "New client" when new client connects).

I am using the same version of everyhting (Arduino IDE, ESP32 package) I was using for last year at lest, no recent updates.

Was anything changed in hardware?
@stable forge do you happen to know?

Anyone has any suggestions?

#

I am using a fairly old version of Arduino ESP32 core (2.0.16); I know they had moved to version 3 quite a while ago, but up until now, old version worked fine, and my motto was "do not fix what is not broken". Especially since version 3 is not backward compatible with v2.

stable forge
#

let me know about how this goes, so we can change libraries etc if necessary, and research whether there's been a parts change that wasn't obvious

vivid rock
#

Thanks a lot! I'd never find it on my own...

#

I wonder what changed to make it necessary

stable forge
#

did 15dBm work too?

#

it could be a change in the ceramic antenna part. Or maybe there was a chip or matching network change in the module

vivid rock
stable forge
#

On the QT Py, the match to the (even tinier) ceramic antenna is not that good. At some point the radio circuitry detects the bad match and throttles back the power. The antenna, or maybe the match circuitry can also heat up and then start throttling. The antennas on the larger boards are better matched: the antennas are larger and there is more room to leave space around the antenna

vivid rock
#

yes, I did notice that ot was getting really hot before the change

stable forge
#

the larger boards are also better heat sinks for the module. The Qt Py's get hot no matter what

vivid rock
#

15dbm works as well

stable forge
#

I will ask about this internally; I did ask once already but now we have evidence of an issue on two different platforms. And I'll order new ones to check.

vivid rock
stable forge
#

this is very nice!

vivid rock
#

thanks

stable forge
#

i read that tindie was down, but is coming back (arturo182 was talking about it on bksy)

vivid rock
#

it is working as of now, but yes, the site seems to run on autopilot

stable forge
vivid rock
#

indeed, it was working ysterday. Oh boy.
Let's hope they fix it

stable forge
plain dirge
# stable forge does that match with the pin you think it is?

Yeah, it is clearly labeled in that diagram. I later debugged to discover the pin I was using was 61, which was ineligible for reassignment. I gave up and just cut the cable from where it was, A15, over to pin 1. Since I started my project with an arduino mega, I wasn't able to use pin 1, because it was needed for serial back to the computer at that time, but the Grand Central M4 Express doesn't need pin 1, so that made the decision easy. I only have a couple more instances that I'll need to physically rewire, and if I do another version of the circuit board, I'll be able to fix it. Thank you!

sweet escarp
#

Anyone know how I can get this salvaged LCD panel to work I figured out the top two pins are for just the power button but I'm not entirely sure where to start on this 14 pin plug I was thinking of hooking it up to an Arduino first so I could at least figure out what pin does what.

hardy gull
# sweet escarp Anyone know how I can get this salvaged LCD panel to work I figured out the top ...

I don’t know how far you’ll get, but the pics are helpful. The 74HC595 is a serial to parallel converter. That means you’ll talk over SPI and it will convert to 8-bit parallel for the display. Use an ohmmeter to relate that chip to the 14-pin connector.
https://www.build-electronic-circuits.com/7400-series-integrated-circuits/74hc595-74ls595/

Build Electronic Circuits

This is a guide to the 74HC595 (and 74LS595) chip. Learn how to use this chip in practical circuits with our 7400 Series IC Guide.

#

But once you’re talking to it, you still need to determine what the display driver is. I think there’s a certain set of registers you need you write to before the display will actually work. I guess the easy way is to try every display driver that Arduino supports?

sweet escarp
#

Okay so at least using my multimeter I managed to find VCC for the chip

#

Ground is a little more tricky because the pin out I'm getting three different grounds on the pins

hardy gull
#

It’s ok for three pins to be ground

sweet escarp
#

Actually that works out nicely because I only got really the 10-pin ribbon cable for the Arduino so that means if I have one VCC three ground that means I have 10 data pins at least

hardy gull
#

We also need pins 10-14

#

Pins 1-7 and 15 will hook up to the display

#

9 is probably unused

#

By the way, I can’t find any info on that 9CAV80K from TI, but I think it’s something to read the buttons

sweet escarp
#

When I searched it up it said it was a hex inverter

#

I searched the number under it instead of the top one

sweet escarp
# hardy gull We also need pins 10-14

So looks like everything goes into this hex inverter first and then it just moves around to wherever cuz I was testing with the multimeter on continuity mode and I managed to map out some of the pins or at least attempted to

hardy gull
#

74HC04. Ok. So they’re using it as a level shifter

#

Any idea if the display takes 3.3v or 5v?

#

I think you know enough now to figure it out. Let us know where you get stuck

sweet escarp
#

const int DATA = 5; const int LATCH = 9; const int CLOCK = 13;
const int P2 = 4; const int P8 = 7; // Your 'Unlock' pins

void setup() {
pinMode(DATA, OUTPUT); pinMode(LATCH, OUTPUT); pinMode(CLOCK, OUTPUT);
pinMode(P2, OUTPUT); pinMode(P8, OUTPUT);

digitalWrite(P2, LOW); // Board sees HIGH (Unlock)
digitalWrite(P8, LOW);
}

void sendInverted(byte b) {
digitalWrite(LATCH, LOW);
for (int i = 0; i < 8; i++) {
digitalWrite(DATA, !((b >> i) & 1)); // Flip for the 74HC04
digitalWrite(CLOCK, LOW); delayMicroseconds(10); digitalWrite(CLOCK, HIGH);
}
digitalWrite(LATCH, HIGH);
}

void loop() {
// We want Bit 0 (White LED) ALWAYS ON.
// We'll cycle Bit 3 through 7 to see if we can trigger the LCD backlight.
for (int i = 3; i < 8; i++) {
byte pattern = 0x01 | (1 << i); // Bit 0 (White) + Test Bit 'i'
sendInverted(pattern);
delay(500);
}
}

tired kite
#

Looking for some help with ESP32-S3 QT PY, TLV320DAC3100, and ANO Stemma QT rotary encoder. I'm having trouble getting the TLV320 recognized by the QT PY.

  • ANO encoder is showing up on I2C, TLV320 isn't.
  • I've tried breaking the Stemma points out directly from the QT PY and then connecting those to the TLV320 and still nothing.
  • I've tried daisy chaining the TLV320 from the ANO stemma QT connector and this actually causes the ANO encoder to register button presses without physically pressing any buttons.
  • Assigning GPIO pins as I2C pins also doesn't register the TLV320.
  • I double checked my solder and connection points from the TLV320 and I have continuity, so I'm good there.
  • I tried the Arduino sine wave example from the TLV320 docs and couldn't get it working with the ESP32-S3, but I think that's moot since it's not showing up on I2C.
  • Only thing I haven't tried at this point is the 'reset' that is mentioned in the adafruit docs, but it isn't clear if this is required BEFORE you can use the TLV320, or if this is just to reset it and program the codec again.
  • I just found the I2S example within the TLV320-I2S library, but from what I can tell there's only the reset pin connected to the ESP32, plus vin and gnd. Is this what I'm missing?
#

I'm about to cut my losses and move back over to the UDA1334A unless someone can tell me why it's not showing up via I2C at all.

hardy gull
sweet escarp
hardy gull
#

Ok. We’ll need to find a display expert to help.

sweet escarp
#

got the buzzer to work also, just not the screen yet

hardy gull
#

If it doesn’t even acknowledge its own address, you won’t be able to continue. Could be the chip is fried, or a soldering issue. Check SDA with a meter and verify the pull-ups are working

tired kite
#

Yeah, I double checked all solder points and reviewed wiring on the breakout board numerous times. Nothing on the I2C address scan.

tired kite
hardy gull
#

SCL should be too

limber blaze
#

Is there anyone that can help me with the NAU7802 ADC chip (https://www.adafruit.com/product/4538), please? I'm trying to write an application to utilize it, and having Claude.ai help me with it.. Claude thinks there's a bug in the library, but that would honestly really shock me.

limber blaze
#

I uploaded the library code (Adafruit_NAU7802.[ch]) to Claude, then uploaded the datasheet from Nuvoton to it as well. It still thinks there's a bug. I'm still hesitant.

hardy gull
#

What is the issue? Is the library not working?

#

That chip is super noisy, btw. I only got 12 ENOB when I used it, instead of the 18 I expected.

hard dust
hard dust
#

DM me if you've any urgency with ur project and you're facing any problem....either the problem is in circuit or code I could help u

hardy gull
dusk orchid
obtuse spruce
#

Is there a nuance to C++ static structure initialization under Arduino? I have something like:

const FooBar foo("foo for you", {1,1,2,3,5});

Where FooBar is a class that has a constructor. Normally, this c-tor would get called before main() ... but under Arudino, do those happen?

stable forge
crude heart
#

new to matrixing

#

I'm wondering if I will be able to share a line for my switch and LEDs on these PB86 A1 switches

#

was thinking something like this

hardy gull
#

If you dedicate that column to LEDs it should work. Will be interesting writing the software

#

Are you driving the rows or the columns?

obtuse spruce
#

ooooh - just found a small nit in Adafruit's wiring.c for SAMD51 :

  // Initialize Analog Controller
  // Setting clock
#if defined(__SAMD51__)
  //set to 1/(1/(48000000/32) * 6) = 250000 SPS
#

Yes, indeed, the ADC clock is set to to be 48M/32 - and the sampling duration is set to 6 clocks.... but the sample takes one more clock for each bit of result! So, at the default of 10 bit samples, you really get:

// set to 1/(1/(48000000/32) * (6 + 10)) = 93750 SPS
hardy gull
#

That's fast for a SAR ADC. I wonder how much noise you get?

obtuse spruce
#

Well.... if I'm running I2S on the chip - then lots! But, using the ADC averaging feature works nicely... Further, I found that I can increase the SPS significantly, and then use even more averaging, which results in less noise on the read data.

I just tested using a clock divisor of only 4, upping the sample duration to 36 (so the total time in acquisition is the same as before. This actually gives 250k SPS (at 12 bit)... but then I'm using 512 sample averaging... yielding 488 SPS

hardy gull
#

That's a surprising result. I guess it means your noise is mostly external

obtuse spruce
#

I don't know... Disconnecting the I2S DAC isn't enough to make it stop. Have to turn off I2S... But could be my wires and breadboards are acting as antennae.

obtuse spruce
#

Did lots of measurements with different settings of ADC clock divisor, and averaging sample size: Turns out using a smaller divisor adds only minimal amount of noise - but makes the reads much faster. This enables using a higher averaging sample size, which has very large effect by smoothing out the noise.
For example, using a clock divisor of 4 and averaging 256 samples gives about half the noise that a clock divisor of 16 and an average of 64 samples does

gloomy tundra
#

Hi y'all! I'm looking to get some help debugging a BME680 sensor/Raspberry Pi Pico W setup. I'm using the I2C1 connection on the pico w (GP6 and 7), but the BME680 fails to initialize using the example test code. That being said, if I use the example code from the BME280, which exposes Adafruit_BME280.sensorID(), the program can read the sensor ID of 0x61. That ID is representative of the BME680 and implies that my wiring is fine and that both boards work to some extent. I've tried multiple I2C pins on the pico w, as well as changing the Adafruit_BME680 object's initialization to having no argument, &Wire, and &Wire1. SPI also fails but it won't be a long term solution (the BME680 is being used in place of a BME280 for educational activities, and the PCB is wired for I2C).

If anyone has ideas on what I can try next, that would be great!

stable forge
gloomy tundra
#

The code I'm using is the example code directly from the libraries. Relevant snippet from the BME680 code:

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME680.h>

#define BME_SCK 6//13
#define BME_MISO 7//12
#define BME_MOSI 8//11
#define BME_CS 9//10

#define SEALEVELPRESSURE_HPA (1013.25)



Adafruit_BME680 bme;//(&Wire1); // I2C
//Adafruit_BME680 bme(&Wire); // example of I2C on another bus (also doesn't work)
//Adafruit_BME680 bme(BME_CS); // hardware SPI
//Adafruit_BME680 bme(BME_CS, BME_MOSI, BME_MISO,  BME_SCK);

void setup() {
  Serial.begin(9600);
  while (!Serial);
  Serial.println(F("BME680 test"));
  //Wire.setSDA(6); // causes problems; serial never connects
  //Wire.setSCL(7); // causes problems; serial never connects

  if (!bme.begin()) {
    Serial.println("Could not find a valid BME680 sensor, check wiring!");
    while (1);
  }
``` (it never gets past this point)
#

The BME280 code that reveals the sensor ID:

#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme; // I2C
//Adafruit_BME280 bme(BME_CS); // hardware SPI
//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI

unsigned long delayTime;

void setup() {
    Serial.begin(9600);
    while(!Serial);    // time to get serial running
    Serial.println(F("BME280 test"));

    unsigned status;
    
    // default settings
    Wire1.setSDA(6);
    Wire1.setSCL(7);
    bme.begin(BME280_ADDRESS, &Wire1);  
    // You can also pass in a Wire library object like &Wire2
    // status = bme.begin(0x76, &Wire2)
    if (!status) {
        Serial.println("Could not find a valid BME280 sensor, check wiring, address, sensor ID!");
        Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(),16);
        Serial.print("        ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n");
        Serial.print("   ID of 0x56-0x58 represents a BMP 280,\n");
        Serial.print("        ID of 0x60 represents a BME 280.\n");
        Serial.print("        ID of 0x61 represents a BME 680.\n");
        while (1) delay(10);
    }
stable forge
# gloomy tundra The BME280 code that reveals the sensor ID: ```#include <Wire.h> #include <SPI.h...

The BME680 can have one of two I2C addresses: 0x77 or 0x76. This is determined by the SDO pin. If it is grounded it is 0x76, if it is high, the address is 0x77. If it is floating then it could be either, and the datasheet says don't do that.
Our breakout has it pulled high, and there's also a resistor to pull it low if a jumper is soldered.
If you are using someone else's breakout, then you'll have to check that one. I'd say do an I2C scan and see what address is showing up.

gloomy tundra
# stable forge The BME680 can have one of two I2C addresses: 0x77 or 0x76. This is determined b...

I'm using the adafruit breakout, and the tutorial doesn't mention wiring the SDO pin, so I'm assuming that I'm good on that front. I have not soldered the jumper, and the BME680 breakout is the only thing connected to the pico w.

Using a scanner (https://learn.adafruit.com/scanning-i2c-addresses/arduino), nothing is detected on Wire or Wire1. Odd that the sensor ID can be detected but not the address

#

(changing the Wire via line 13: ```
// Set I2C bus to use: Wire, Wire1, etc.
#define WIRE Wire1

stable forge
#

are you using the same 680 breakout with the 280 library?? I'm confused

gloomy tundra
#

I want to use the 680 breakout with the 680 library. That wasn't working, but I knew that the 280 library example had code to detect the sensor ID while the 680 library example didn't. So, I figured "why not" and tried using the 280 library code to see if the board could be detected at all

#

I know that the 280 library won't work in the long term, but I hoped that using it could help eliminate hardware issues like a bad board

stable forge
#

ok, got it. have you tried CircuitPython and the 680 CircuitPython library?

#

I do have these parts so could try it

#

the original program without all the wire/spi changes looks fine

#

could you take a picture of your wiring?

gloomy tundra
#

I can do so in like an hour or so! I started the debugging yesterday but am working remotely on this until the afternoon. I'll also be able to switch to CircuitPython when I can press the bootsel button

gloomy tundra
#

The wiring I'm using. I'll get circuitpython set up in a bit!

gloomy tundra
#

Ok, I used the CircuitPython equivalent of the I2C scanner, and it found the BME680 at 0x77! Yay! That confirms that the hardware should be fine

stable forge
#

BME680

blazing vine
#

Hey there. Trying to learn microprocessors. I have a pretty extensive coding background but just never touched these until now.

#

I have an Adafruit Feather ESP32 V2. I'm running ESP32 core 3.3.8 on Windows with the Arduino IDE 2.3.8

I keep getting the following error.

#

I have tried:

  • 3 different cables.
  • Different ports.
  • Slower upload speed.
  • Erasing the flash memory.
  • A CH9102 driver.

Nothing has worked. Clicking reset on the board doesn't do anything, so I'm assuming the led flashing code isn't even being written to it. The code I try to send is as follows.

#define LED_PIN 13
void setup() {
  pinMode(LED_PIN, OUTPUT);
}
void loop() {
  digitalWrite(LED_PIN, LOW);
  delay(500);
  digitalWrite(LED_PIN, HIGH);
  delay(500);
}
sharp turret
#

(My workflow is to flash first with 500/500 and then again with 100/100. That proves to me whether code is making it to the board or not.)

sharp turret
blazing vine
sharp turret
blazing vine
sharp turret
#

esp-tool thinks it is flashing the ROM.

#

My only other idea would be to see if you can install CircuitPython on the board. If not, then maybe there is something wrong wtih the flash.

#

I don't see an obvious mistake.

blazing vine
sharp turret
#

lots of things are possible

#

likely? no. possible? Yes.

blazing vine
sharp turret
#

Yes, it is a method to determine if the flash is flashable. But may also be a better entry point since CP is relatively easy to work with compared to C++.

blazing vine
sharp turret
blazing vine
#

Alright I've tried multiple cables, multiple ports.

#

And on two different PCs.

#

It stops at 2% on both.

blazing vine
stable forge
#

HUZZAH32 and V2?

stable forge
#

ok great, could I see a top view? Did you solder the headers yourself?

stable forge
#

soldering looks excellent

blazing vine
#

Just wanted to get a feel for things before trying my hand at that.

#

It came like this.

stable forge
#

do you have any other boards or just this one?

blazing vine
stable forge
#

ok, I will try to duplicate locally on a Win11 machine, but there's certainly something fishy about the loading. Would you be comfortable running esptool yourself?

#

you can find the executable in the arduino directories somewhere, or pip install esptool in a python installation

blazing vine
stable forge
#

yes, and same IDE version, etc. same OS

blazing vine
stable forge
#

try compiling/loading File->Examples->Basics->Blink

blazing vine
stable forge
#

in the Arduino IDE

blazing vine
#

Is USB-3 not advisable with these? Or does it not matter? I've tried USB-C to USB-C as well.

blazing vine
stable forge
#

usb-3 is fine. The board has an onboard serial-USB converter chip which should be happy with USB-C. I am using a USB-C to USB-A cable, and a USB3 USB-A port (blue)

stable forge
#

good, you don't need to alter the program in any way

#

just hit the -> button in the upper left

stable forge
#

ok, mine is identical except for the verify failure, and my chip version is v3.0 instead of v3.1. Could you click on the tools menu and verify that the settings match this picture (except for maybe the COM port):

blazing vine
#

Looks the same other than COM, Erase being enabled, and the slower upload speed.

stable forge
#

ok, you lowered the upload speed, but no problem. Do you get the same bad MD5 flash value each time?

#

if you tried flashing again

#

are you connected via an external hub, or directly to the USB port?

blazing vine
#

Seems to change.

#

Yeah tried it a few times. Input stays the same, Flash changes each time.

stable forge
#

after a little research I see one thing to try. Do you have a python installation on the machine now?

#

it involves running esptool. I'm looking where it might be from the arduino installation

#

if i can't find it, we can install it via python

blazing vine
stable forge
#

there's some possible bad setting for the flash chip. I didn't know about this until now. Yes, it should work out of the box. We can get you a replacement, but if we can get it to work, that will save some time. We are happy to replace it. 99% of the time it is some setting or software problem, USB cable, etc. This is one of the small cases when it might be the board.

blazing vine
stable forge
#

C:\Users\YOURUSERID\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\5.2.0\esptool.exe --chip esp32 --port COMxxx write_flash_status --non-volatile 0

#

in a terminal window, change YOURUSERID and COMxxx to the appropriate

#

people with the same MD5 error as you were able to solve it with this. The board as you got it should not need this, but worth trying

blazing vine
stable forge
#

removed a stray doublequote there

#

it's just a little easier to deal with esptool when it's installed via python. It exists in the Arduino esp32 board package, but it took me a while to find it. Windows file search is not fast 🙂

blazing vine
stable forge
#

i have a guitar lesson in 15 minutes so if we don't finish I'll circle back

#

so try that command, and then try uploading again

stable forge
#

yah, hmmm

#

try the upload. If it doesn't work, open a thread in https://forums.adafruit.com, ping me with the URL, and I'll authorize a replacement. That's the "official" support channel.

blazing vine
#

I don't have high hopes since the flash memory status seems to have not changed but meh I'll try.

#

It is what it is I guess.

stable forge
#

ok, let's replace it!

#

interesting for me:

Initial flash memory status: 0x0200
Setting flash memory status: 0x0000
After flash memory status:   0x0000
#

so 0x0200 was OK for my board when uploading. So yes, I think the flash chip has a problem

blazing vine
# stable forge ok, let's replace it!

So the issue right now is that I'm actually Canadian. I got it through a 3rd party provider called https://www.pishop.ca/ for the sake of shipping cost/time.

stable forge
#

this sounds like a bad batch or something

#

Could you post there and I will turn this over to adafruit_support_carter who is one of our offical support folks. I am a CircuitPython core developer, not arduino.

#

take a picture of the bag it came in if you still have it

blazing vine
#

Arduino?

#

?

stable forge
#

for now post in that same thread I linked to above. If more than one person is having this problem, we need to check whether it's a problem with new stock before we just send you a new one.

#

arduino would be the right forum in general

blazing vine
#

Alright that should be it.

#

I'm not exactly too sure of your relationship with Adafruit, but thanks for the troubleshooting nonetheless.

stable forge
#

I work for adafruit!

#

thanks for your patience answering all my questions

blazing vine
# stable forge I work for adafruit!

I will be honest though, I am a bit worried as to how long it will take for all of this to be handled. You mentioned there might be something wrong with the batch, and that it might need to be looked into. I was looking for a quick personal project, and not something to be sitting on for multiple weeks. I'm sure you personally don't know the ETAs on any of this, but if we're in the ballpark of 2+ weeks to a month, I would probably prefer to get a refund. I guess we'll see.

stable forge
#

i'm not sure how it's done with out-of-country distributors, but it will either be directly from us or we'll work with pishop.

blazing vine
#

Should I tag you or something in that thread btw?

#

Or are we good?

stable forge
#

i've alerted the other adafruit staff in that thread and will talk to him when he's around

blazing vine
#

kk

open gull
#

I am trying arduino-ide v2.3.8, seeing there is sdkconfig.h file.
How can i edit or make this like esp-idf?

errant geode
#

Hey. Is it possible to connect touchscreen to d1 mini? I don't have any yet, but the problem is I want very small device like d1 mini with touchscreen, sd card slot, Bluetooth module and at least 1 button and 1 pin to read battery voltage level. It is possible?

north stream
#

Yeah, should be. It looks like it has enough I/O pins.

tough snow
#

@errant geode A number of such devices run on SPI, which while it initially requires four pins, additional ones only require one.

#

I2C is worth looking into too, since it uses two pins for a large number of devices.

velvet kayak
#
  // put your setup code here, to run once:
  pinMode(7, OUTPUT);
  Serial.begin(9600);
  while (! Serial);
  Serial.println("Ready.");
}

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



  if (Serial.available() > 0) {

  char message = Serial.read();
  Serial.println(message);  
  
  if (message = "1") {
    digitalWrite(7, HIGH);
    Serial.println("On");
    delay(1000);
    message = "";
  }
  if (message = "0") {
    digitalWrite(7, LOW);
    Serial.println("Off");
    delay(1000);
    message = "";
  }
  }
    
  
}```

Whenever I enter "1" into the serial monitor
#

the arduino seems to recieve an "ON" and "OFF" signal, twice in a row.

#

I have zero clue why.

#

as you can see, it's not recieving another input

#

is there something I'm missing?

obsidian hamlet
#

I'm sending data over 2 gpio pins (1 for clock, 1 for data) between 2 feather m4s (120 mhz). my sending code looks like this:

void sendToM4 (const char *str) {
  for (int i = 0; i < strlen(str); i ++) {
    byte chr = str[i];
    for (int j = 0; j < 8; j ++) {
      digitalWrite(M4_DATA, chr & 1);
      delay(50);
      digitalWrite(M4_CLK, HIGH);
      delay(50);
      digitalWrite(M4_CLK, LOW);
      delay(50);

      chr >>= 1;
    }
  }
}

how short can i safely make the delays?

#

(the receiving side is just a plain interrupt)

#

i don't think i need the first delay

obsidian hamlet
#

testing has told me i dont need the second delay either

#

it still triggers the interrupt on the receiver like it should

obsidian hamlet
#

well a delay of 10 ms doesnt work but 15 ms does, reliably

#

so i'm going with that

glossy flint
#

Hi guys,
I am very new to Arduino in general, and was wondering if someone could help me out.

I am doing a tutorial to get a DS18B20 working with Blynk.

If I do the simple example in DallasTemperature , everything works fine and displays the temp in the serial monitor.

But when I use the following code, The wifi connects on the ESP8266 and connects to Blynk, but no data is shown.
And then when I open the serial monitor it just does a ? every second or so.

This is the code.

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
char auth[] = "authcode";

/* WiFi credentials */
char ssid[] = "WIF";
char pass[] = "password";

/* TIMER */
#include <SimpleTimer.h>
SimpleTimer timer;

/* DS18B20 Temperature Sensor */
#include <OneWire.h>
#include<DallasTemperature.h> 
#define ONE_WIRE_BUS 2 // DS18B20 on arduino pin2 corresponds to D4 on physical board
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
float temp;

void setup() 
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  DS18B20.begin();
  timer.setInterval(1000L, getSendData);
}

void loop() 
{
  timer.run(); // Initiates SimpleTimer
  Blynk.run();
}

/***************************************************
 * Send Sensor data to Blynk
 **************************************************/
void getSendData()
{
  DS18B20.requestTemperatures(); 
  temp = DS18B20.getTempCByIndex(0);
  Serial.println(temp);
  Blynk.virtualWrite(10, temp); //virtual pin V10
}```

Would anyone have any idea on how I can go about fixing this?
north stream
#

@velvet kayak You have two issues I can see. One is that "=" is the assignment operator, not the comparison operator. Another is that you're comparing a character to a string. So instead of c if (message = "1") {

#

you probably want ```c
if (message == '1') {

#

The == operator is the comparison operator, and '1' is a character value.

glossy flint
#

Sorry I made that messy code earlier, the second I sent it my power went out and i didn't get a chance to fix it haha

opaque hollow
#

@glossy flint you might need to change your baud rate.

wet crystal
#

Hey I have a question,
I have bought one of these
https://www.amazon.de/Capacitive-Moisture-Corrosion-Resistant-Raspberry/dp/B07FLR13FS

I tried them out on my Arduino Uno/Mega/Micro and Nano. It works but slower than i saw in some videos
With the same code like in this video, I even tried to wire AREF to 3,3 V with no results.
Surprisingly with wemos d1 mini, like in the video works.
Now i would like to know why.

https://www.youtube.com/watch?v=94G7iTvlkBM

In this video I'd like to present you cheap chinese capacitive humidity sensor for Arduino or ESP. See quick setup with Arduino IDE together with Wemos D1 Li...

▶ Play video
opaque hollow
#

@wet crystal How are you retrieving the data? Are you displaying it over the serial port? Also, if you are using any delays in you code, then it will run slower.

wet crystal
#

Hi

#

I use serial connection

#

I use the same code

#

On wemos runs smooth

#

On all other it needs couple minutes to get right value

opaque hollow
#

Hmm... It might have to do with the clock speed of the devices.

north stream
#

Could also have something to do with the (electrical) ground connection.

wet crystal
#

@opaque hollow To find that out i would have to change crystal on arduino right?

opaque hollow
#

I'm not entirely sure.

north stream
#

That's not really practical, a 5V Arduino runs at 16MHz, the D1 runs at 80MHz. However, I doubt that's the real problem. You mentioned tying AREF which implies an analog connection, but you say you're using serial?

wet crystal
#

I tried setting the AREF to 3,3V with the connection.

north stream
#

What is the data doing while it approaches the right value? Is it changing slowly, or wandering around?

wet crystal
#

With the Wemos

#

It´s just jumping to the right value

#

On 5V arduino it´s slowly reaching the spot

north stream
#

Could be a serial buffer issue or a multiplexer timing problem.

#

Or a more basic timing or impedance problem. I'd probably do a little testing with a pushbutton switch to isolate the problem.

wet crystal
#

May you give me some more details of how to test this?

north stream
#

Try replacing the sensor with three resistors in series connected between 5V and ground. Measure from the top of the bottom resistor. You should get about 1/3. Then short circuit the middle resistor: the reading should immediately jump to 1/2.

wet crystal
#

May i contact you again later. I now have to get my wife from the trainstation

north stream
#

I'm in and out all day.

north stream
wet crystal
#

Like this?

north stream
#

Yes, you've got it

wet crystal
#

KK

#

I will look

#

Doesn´t matter wich size of resistor?

north stream
#

Doesn't matter too much. The 220Ω ones you show should be fine. I used 10kΩ.

wet crystal
#

Yep

#

Experiment went good

#

I don´t know what else to try

north stream
#

So the Arduino responded to the resistor changes quickly?

wet crystal
#

Yes

#

I have some arduinos here

#

I tried them all with the sensor

north stream
#

That eliminates a lot of possible sources of error. What's left is weird stuff like impedance and power supply capacitance issues.

#

Do you have any higher value (like 10kΩ) resistors handy? If so, it might be worth connecting up the sensor, and adding a resistor from the signal lead to ground to lower the impedance.

wet crystal
#

Sure i have

#

I´ll give it at try

#

10kΩ? or maybe another value?

north stream
#

I'm not sure what the drive capability of the sensor is. I'd probably try 10kΩ - 100kΩ to avoid overloading it.

wet crystal
#

I can take a fast search for the specs if you want to

north stream
#

I'd be curious: you've happened upon an intriguingly odd problem here. I'm trying to figure out what the difference is between the D1 and Arduino in this case.

wet crystal
#

So

#

With 10kΩ it´s a little bit fast and with 100kΩ some more little faster

#

But not as fast, as the wemos

#

But maybe it´s just faster in my mind

north stream
#

That's really interesting. I would have expected it to be faster with 10kΩ than 100kΩ. It does seem to support the notion that it may be impedance related.

wet crystal
#

That was the only i found. It´s not 100% the same, but i guess they work the same

north stream
wet crystal
#

It seems like he is trying to say, that this won´t work

north stream
#

Which is odd, as it demonstrably does work.

#

However, I can understand how that 1µF capacitor would slow the response to a high-impedance input (apparently the built-in resistor is a megohm).

#

It is arguably a strange design (I had guessed the chip was a dual op-amp, not a timer).

maiden plank
#

I have an Arduino trinket and would like to skip the bootliader on initial power and instead only do the bootloader when I press the button. How?

wet crystal
#

Upload without bootloader

velvet pike
#

but the code keeps throwing up

exit status 1
two or more data types in declaration of 'setup'

north stream
wet crystal
#

@velvet pike Post full error message pls

north stream
wet crystal
#

KK

#

Any new Ideas about my problem?

velvet pike
#

@wet crystal deleted. apologies

north stream
#

Yours is an odd one. I'd be tempted to watch the voltage on the input pins on both (with a multimeter or better yet an oscilloscope) and see what's happening.

#

All I have at this point are guesses, and I don't have any concrete suggestions other than leaving the resistor when using the Arduino.

wet crystal
#

I will try the multimeter, but from there i guess is nothing i can do.

north stream
#

That may be the case. That sensor looks like it wasn't really designed to capture rapid changes, and just happens to due to some quirk (pullup resistors?) in the D1.

wet crystal
#

Ok

#

I tried with a multimeter

#

max is 2.6 V

#

If i drop into water it rapidly goes to 0,8V

#

Even if the refvoltage isn´t the right, the values should rapidly change, or?

north stream
#

The trick is to compare the behavior between the D1 and the Arduino

wet crystal
#

Ok

#

Found something interesting

#

Sensor also works with Attiny85

#

That is really confusing XD

north stream
#

Curiouser and curiouser

velvet kayak
#

Is there an internal list of "codenames" for the Pins on the arduino Uno? DigitalRead requires a uint8_t. I need to know which pin is which character. I believe it's 1, 0, etc for the first few, but what about the Analog pins? A0, A1, are two characters.

tough snow
#

@velvet kayak A0, A1, etc work for DigitalRead

velvet kayak
#

void loop() {
  sendData("Hello World!");
  delay(5); 

  if (Serial.available() > 0) {
    setLight(Serial.readString());
 
  }

}

void setLight(String pin) {
  digitalWrite(pin, !digitalRead(pin));
}
cannot convert 'String' to 'uint8_t {aka unsigned char}' for argument '1' to 'int digitalRead(uint8_t)'
#

the issue is I'm trying to pass a variable directly from serial

#

(I've cut out non-relevant functions)

tough snow
#

Ahhhhh

velvet kayak
#

Yeah, everyone has misinterpreted my question so far. It's kinda frustrating. /:

#

but I understand why

tough snow
#

Don't forget to set the pinmode, too.

velvet kayak
#

yeah, I do that in setup

tough snow
#

Just making sure

#

OK, so, hmm. You're going to need to convert it to an int. And for an int, you need the pin numbers for the analog pins.

#

Where's the serial coming from?

velvet kayak
#

Yeah. How can I figure that out?

#

Serial is coming from a PC, undetermined OS. I'm using a Unity program to transfer it.

#

USB, I mean

tough snow
#

Was more looking for the "Unity Program"

velvet kayak
#

?

#

WRMHL is the library I'm using.

#

to communicate that is

tough snow
#

Not worried about the OS or anything specific, just curious what's doing the talking (And why)

velvet kayak
#

A unity program waits for inputs, transfers over relevant info. Usually a single character, although a string could be useful because then I could directly refer to A0, A1, etc. But since readstring takes an unsigned char, one character works.

#

I had it working earlier with one pin predetermined, I'm just now trying to get it to work with variable input.

#

THe input is never user decided.

tough snow
#

You could use a switch

#

Which would compare the raw characters and do things based on each.

#

It's a fancy if/then tree. One sec while I look it up

velvet kayak
#

Yeah, I know what a switch is. I could probably do a case for one character inputs, then just feed in the int? And if it's an analog, then use a special scenario and enter it in manually. It'd look ugly and take up some more space but that isn't an issue currently.

#

If digitalRead just takes a special or certain char for the analog pins, it's easiest to use that.

tough snow
#
    case "1":
        setLight(1);
    case "A0":
        setLight(A0);
}```
#

Yeah, I'm still digging for those

velvet kayak
#

I wish the documentation was a bit more specific on the internals. I mean the website version. I guarantee the OSS docs are chock full of every piece of info.

#

or, rather, OSH :D

tough snow
#

Alright, so

#

Program Files/Arduino/hardware/arduino/avr/variants/standard/pins_arduino.h

#

A0 is 14, A1 is 15, etc

velvet kayak
#

wow, thank you! That doc contains them all?

tough snow
#

For standard AVR boards, it looks like

#

That doc is the file that sets them

velvet kayak
#

I'm using the Arduino Uno R3 from Elegoo

#

gotcha

#

I'll check my own then lol

tough snow
#

It should be the same, it's a file that comes with the IDE

velvet kayak
#

yep, found em!

#define PIN_A0   (14)
#define PIN_A1   (15)
#define PIN_A2   (16)
#define PIN_A3   (17)
#define PIN_A4   (18)
#define PIN_A5   (19)
#define PIN_A6   (20)
#define PIN_A7   (21)```
#

thanks, you really helped me out here!

tough snow
#

And if you take a look below, they're actually set as ints with those specific assignments. Seems a little excessive to me

#

No problem!

velvet kayak
#

wait

#

@tough snow

#

does that mean that the 14/15

#

are actually ascii values?

tough snow
#

Negative, they're integer values

velvet kayak
#

uhhhh

#

guess I'm back to square one? lol

#

I needed a char anyways

tough snow
#

"all" you need to do is pass a value between 0 and... 21 via serial, and then convert it to an int

velvet kayak
#

Yeah but digitalRead requires a char

#

I tried using an int

#

I didn't realize that haha

tough snow
#

Have you tried casting it directly as a uint8_t?

#

That's the variable type that "A0" "A1" etc are

velvet kayak
#

What do you mean casting it directly?

#

I guess I'm confused

#

What should I send down over serial?

tough snow
#

I'm not sure

velvet kayak
#

I can send strings down using my library.

tough snow
#

That's likely the best option. I'm not super familiar with Arduino serial

velvet kayak
#

I think I'm just going to use the case / switch

#

It makes sense

tough snow
#

I think you need to convert it to a uint8_t but I'm not sure how

velvet kayak
#

I only have to write six scenarios, then just default to passing it directly

#

If I read it as a char it should just pass over directly then

tough snow
#

Yeah, and you can always update it later if you get a better version working.

velvet kayak
#

Yep. Thanks for the advice. Your expertise, is appreciated.

tough snow
#

Happy to help

velvet kayak
#
    pinMode(lightinit, OUTPUT);
  }```

At least I could enable output on all my pins with some simple code!
#

currently working on the cases.

iron otter
#

Hey folks! Apologies for the extreme first time question, starting on my first circuit. I'm looking to turn a footswitch used in music performance into something that'll send keyboard signals to my PC when pressed down.

I've got an Arduino Uno and I'm wondering if others have done something similar with a switch which terminates in a 1/4" TRS male plug as above--does this seem possible?

And would buying a TRS female and running the wires from it on the other side be viable as a way of plugging the pedal into an Arduino board without having to chop up the original pedal?

#

Diving into all the reading tonight and tinkering with the Uno / the blink program and the like but am wanting to get any extra hardware I'll need on order

velvet kayak
#
  if (Serial.available() > 0) {
      char tempbuffer = Serial.read();
      switch (tempbuffer) {
        case 'A':
          setLight(A0);
        break;
        case 'B':
          setLight(A1);
        break;
        case 'C':
          setLight(A2);
        break;
        case 'D':
          setLight(A3);
        break;
        case 'E':
          setLight(A4);
        break;
        case 'F':
          setLight(A5);
        break;
        default:
          setLight(tempbuffer);
        break;
      }


  }```

I felt compelled to share this. It works. It's wonderful. Now, onto the next part...
#

Anyone viewing this channel, scroll up a bit! ^^^^^^^
Sorry for cutting your message off, Etherb0x!

tough snow
#

@iron otter So, good news: You can totally do that! Bad news: The Uno isn't the tool for that. A native usb device (Such as any M0/M4 device or a 32u4) can have libraries to make it show up as a USB device, but the uno uses a 328, which isn't usb native

glossy flint
#

Hey guys,
I have a temperature sensor which I am trying to send the data to Blynk.
I have the baud rate set at 57600 now (thanks @opaque hollow )

Now If I go to Serial Monitor, I just get weird characters, but if I change the baud rate in there to 57600 then I start getting the temps to display properly (I am guessing thats normal?)

My problem is Blynk still isn't reading any data? any idea what the issue is?

This is the code to do with the baud

  Blynk.begin(auth, ssid, pass);
  DS18B20.begin();
  timer.setInterval(1000L, getSendData);
}```
tough snow
#

@iron otter Getting the jack would be a great idea, though.

iron otter
#

Hadn't realized there were starter parts like this on the Arduino site until now and it'd be way more forgiving to step through it this way than solder as a first timer

tough snow
#

@glossy flint I've got no experience with Blynk, sorry

iron otter
#

Thank you for the quick response!

tough snow
#

@iron otter Soldering is a great skill to learn, but it can be intimidating. Learning with breadboards and non-soldering stuff is great

iron otter
#

Yeah, I'll get there, want a victory under my belt and some hobbyist momentum before I start buying the farm in terms of kit and giving up. Real easy to rack up aspirational purchases in the age of instant gratification and 'no time'

glossy flint
#

@tough snow Thats ok mate.. I originally wanted to use home assistant anyway (Hassio)
I was just using Blynk as I thought it would be an easy way to get a result (I am extremely new to Arduino and this space in general haha)
So maybe ill try with home assistant and see if I can get it working

tough snow
#

@iron otter The footswitch to keyboard thing should be fairly straightforward.

#

How much force does it require for the buttons?

#

And one more thing - If you're interested in ease of use, an M0/M4 device can use CircuitPython, which is quite easy to use and learn and program

iron otter
#

Force required is fairly gentle, I was thinking to house the arduino externally at first just to get things working, as I get more familiar I'll be happier to remove unnecessary guts. CircuitPython sounds like it'd be fun, I'm pretty familiar with Lua and have been meaning to pick up Python for work anyways

tough snow
#

@iron otter Oh, cool. Keep us posted on this. That foot switch is quite inexpensive, and that project could be super useful as an accessability item. We've got some ATMaker folks in here who would love to see that sort of thing

iron otter
#

Will do. It seems like the M0 / M4 route with featherwings, a breadboard and some adapters is probably good nondestructive way to get rolling on it

#

So happy I decided to check if there was an Arduino Discord

tough snow
#

If you want size the Trinket M0 would be great. It could get tucked right inside the pedal with minimal impact

velvet kayak
#

I know it sounds strange, but is there an easy way to convert a single char into a String object? Yeah, it's a waste of resources, I know. Most topics on the subject are just people making fun of the OP.

#

This is just going to be used for debugging

#

nvm, found it. String()

#

what a weird name. You'd think it'd be toString()

north kelp
#

Yay, @velvet kayak ! String() looks that way because it's a constructor function for making new String objects. How are you debugging?

velvet kayak
#

Just printing a string. Didn't realize you could just print the characters there.
The ol' printf until something breaks

#
  #ifdef SERIAL_USB
    Serial.begin(9600); // You can choose any baudrate, just need to also change it in Unity.
    while (!Serial); // wait for Leonardo enumeration, others continue immediately
  #endif

  for (int lightinit = 2; lightinit < 10; lightinit++) {
    pinMode(lightinit, OUTPUT);
  }
  
}```

void loop() {
if (Serial.available() > 0) {
char tempbuffer = Serial.read();
switch (tempbuffer) {
case 'A':
setLight(A0);
break;
case 'B':
setLight(A1);
break;
case 'C':
setLight(A2);
break;
case 'D':
setLight(A3);
break;
case 'E':
setLight(A4);
break;
case 'F':
setLight(A5);
break;
default:
sendData(String(tempbuffer));
setLight(tempbuffer);
break;
}

}

}```

  digitalWrite(pin, !digitalRead(pin));
}

This seems to not work though... I think my pin is failing to change to high/low, and yet it still sends over serial the correct character.

#

The case looks at the single character sent over the buffer. If it isn't a special case (aka not a number 0-9) it'll set the right pin

#

I just realized I forgot to set 10-13, whoops

#

still

#

so if I send "2" over serial, the second pin should be set to high, yet it won't. There are zero compiler errors or warnings either.

#

But it's definitely going to default because it prints the string.

north kelp
#

Yeah, reading the pin changes it from an output to an input, and looks for voltage on the wire.

#

The way people usually do what you're trying to do is to use a variable to hold the current state of the pin.

velvet kayak
#

Ah, jeeze, didn't realize. That's strange though, it was working earlier.

#

I honestly feel like using 16 variables would be a mess to keep track of... That was the reason I tried to keep it like that

north kelp
#

You could use an array of chars to hold the states of the lights.

tough snow
#

@velvet kayak Are they simple "On/Off"?

velvet kayak
#

Yep

#

On, and Off.

#

High, Low

tough snow
#

You can use two vairables for all 16

#

Two bytes

north kelp
#

Yes, you could use one variable. 😄

tough snow
#

And use bitread() bitwrite() and bitclear()

north kelp
#

uint16_t

tough snow
#

I use bytes as bool arrays all the time

velvet kayak
#

The really weird part is that it was working earlier. Reading and swapping like that. I wonder why it isn't now.

north kelp
#

I'd just go ahead and waste a few bytes:

velvet kayak
#

I didn't change that section of code at that point.

north kelp
#

char lights[16];

velvet kayak
#

Wouldn't a bool be more efficient, although less than just storing two bytes?

north kelp
#

Even if it worked before, it's not a good practice, IMHO.

glossy flint
#

What would you guys think would be the easiest learning curve to get started with Arduino and Hassio?
Would something like Node Red be more helpful? or something else?

north kelp
#

I'd jump in to simple Arduino examples, using the Arduino IDE, @glossy flint

velvet kayak
#

So why is it bad practice? I just opened a new script, replaced the char with an integer, and it worked, just like earlier. I gave it a delay.

#
  // put your setup code here, to run once:
    pinMode(2, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
    digitalWrite(2, !digitalRead(2));
    delay(100);
}```
glossy flint
#

Thanks @north kelp ill have a browse through them!

north kelp
#

Just checking out Hassio right now, @glossy flint. I might change my mind on what I suggest for getting started. 😄

velvet kayak
#

@north kelp Sorry, why exactly is it a bad practice?

#

Should I swap it back to an output in my function?

north kelp
#

If you do digitalRead() on a pin, you're looking for a voltage on that pin from a voltage or logic source. You're not actually supposed to get what you last did a digitalWrite() to that pin.

#

If theres just an LED on the pin and ground, digitalRead() should report 0, logically, since there's no voltage coming into the pin.

velvet kayak
#

I think I'll just go with the binary array. How do I create a two byte variable?

#

Bools, and Chars use insane amounts of memory.

north kelp
#

A two-byte variable is 16 bits. Depending on your microcontroller's architecture, an int might be 16 bits, or might be 32. So there are explicit types that make your code more portable. I'd suggest uint16_t. That's shorthand for "unsigned integer, 16 bits wide"

#

That uint16_t will be exactly 16 bits on any Arduino board.

#

What board are you running on, @velvet kayak ?

#

BTW, one String() constructor call probably uses way more memory than the 16 chars or bools.

tough snow
#

@north kelp If I remember correctly, the bitread(), bitset() and bitclear() functions on Arduino only work with, specificially, byte (That is, uint8_t) variables

#

But

#

You can use highByte() and lowByte() to extract bytes from, say, an int (Which is a uint16_t)

#

Anyway, I've got sleeping to do, so can't really poke experimentally at anything

north kelp
#

Oh geez. Then if I were using anything bigger than an ATtiny, I'd just use bool lightIsOn[16]; and call it a day.

tough snow
#

I used it because the program I was writing made literally every byte count. There were times it was at 100% of used program memory. It's only something like ~20 bytes off now.

north kelp
#

What was using the bulk of memory?

#

RAM or flash program storage?

#

(or both)

tough snow
#

Flash program storage. It's a huge set of things running on a 328p

#

I'm off now, though. Enjoy!

north kelp
#

Gotcha. Have a good night, @tough snow !

opaque hollow
#

@glossy flint You're welcome. I have used Blynk several times before. It can be a little tricky to get stuff to work properly, but that's where the documentation comes in handy.

velvet kayak
#

I got it working. The code is fairly ugly though, I didn't put much effort into it.

#

I can now enable / disable each pin at will over Serial. This is insanely handy.

north kelp
#

Yay! Congrats, @velvet kayak ! My first cut at just about anything is ugly. And I know it, and I'm OK with it.

echo hinge
#

i'm having troubles attaching an ISR to the slide switch on cplay express. no matter what i do the interrupt only fires when switching to the left

#

mh, looks like the switch is broken 😕

#

ah, it isn't i forgot to call CircuitPlayground.begin(), so the pin was floating … stupid me

native kelp
#

heyy guys

#

got question here

#

its more about the hardware rather than the code

#

but

#

how do i output 5V 100amp from an arduino pro micro?

wet crystal
#

You won´t

native kelp
#

whyy

wet crystal
#

Arduino Pins max outpint max 40ma

native kelp
#

awwww

#

and i needed 100mA

wet crystal
#

You can wire it to 5v and ground

#

max 400 mA when using usb

native kelp
#

im reading the led's like overview and it says something about Forward current If of 100mA and Forward voltage of 1.5V at IF=100mA

#

oh

#

well yeah i'll be using it through usb

#

so you say that i can pro micro 5V model to output 5v and 100mA to the led's

#

if i hook it up via usb

#

though which pin

#

i know that RAW is regulated input

#

VCC is non regulated input

wet crystal
#

VCC and GND

#

VCC =5V

native kelp
#

oh so VCC outputs aswell

#

alright good

wet crystal
#

You can also use it as input

#

But only with 5V

native kelp
#

yeah

#

my plans have not been ruined after all

wet crystal
#

I would suggest you using an external 5V supply

native kelp
#

nah i'll be using the pro micro to fake out a joypad

#

gamepad

#

whatever its called

wet crystal
#

Okay

#

Than you may resolder the USB. Most of them are not good soldered and break off sometimes

native kelp
#

i'll keep that in mind

#

hopefully i wont forget it

#

anyways thanks for the help

wet crystal
#

Or just hold it in place with many hotglue

native kelp
#

lol

wet crystal
#

This is kind of usefull, when you are testing your boards

native kelp
#

what does that thing do?

wet crystal
#

Supply power for the breadboard

#

5V on one and 3.3V on other side

native kelp
#

cool

pine bramble
#

yes

native kelp
#

2 amps is enough for arduino pro micro 5V?

pine bramble
#

yes

native kelp
#

ok then

pine bramble
#

even 200mA

native kelp
#

i think it can go up to 400mA on usb power

wet crystal
#

You can draw 500mA on USB Connection with data

#

100mA for the Arduino

native kelp
#

wdym

#

so the arduino can draw 500mA if i have it on a usb connection

#

what about the 100mA

wet crystal
#

If you have a wall plug it is depending on max A. of the PSU.
But i´am not sure what´s happening if you plug it into USB Port. But you can cute the usbwire, search for + and - and wire that to 5V pins. Than you wire your leds for example in parallel to the 5v and gnd

native kelp
#

i could just wire them to the VCC

#

and GND

wet crystal
#

If you don´t go over 400mA

native kelp
#

i suppose 3 IR led's woudln't go for 400mA

#

i tihnk 300mA for them would be the msot

#

most

#

as i said above, each one of them is rated for like 1.5V 100mA

#

at most they'd use 4.5V if electricity works liek that

#

im no electrician

#

wait

#

i wouldn't fry the IR LED's, would I?

#

if i hook it up to VCC

#

ofc i'd have a resistor

#

at the VCC

#

the resistor is 5.1Ohms 5%

north stream
#

5.1Ω times 100mA is 0.51V, so that seems about right.

#

That's assuming you wire them in series.

#

That also means that their combined draw would be 100mA, which would be fine.

native kelp
#

oh

#

nice

#

because yeah

#

i think they're wired up in series

#

sadly

#

free delivery takes long

#

like 50days

north stream
#

Ordering from China?

#

Why do you want an IR source that's always on? Night vision illuminator? Position reference for Nintendo?

north kelp
#

There are also these, complete with datasheet, available from Adafruit. To my location, USPS “First-Class Package Service” is the cheapest option, at around $4. https://www.adafruit.com/product/388 @north stream @native kelp

echo hinge
#

on circuit playground express, after using CircuitPlayground.speaker.playSound(), the volume of CircuitPlayground.playTone() is very low. any ideas what i could try?

echo hinge
#

in fact this happens after any analogWrite(A0, …)

native kelp
#

i have already found the led's i needed

obsidian hamlet
#

@echo hinge

#

A0 is bound to the speaker

#

guess you'll have to use a different pin

echo hinge
#

@obsidian hamlet i'm using both the analogWrite() and the playTone() with built-in speaker, not at the same time of course. playTone() works fine until the first analogWrite() but is very quiet thereafter.

obsidian hamlet
#

it's still interfering with the speaker

#

it doesn't say that using A0 at the same time as the speaker will mess it up

#

it says that using it at all will interfere

#

it's probably not as bad as that, but you probably shouldn't use A0 and the speaker in the same program

echo hinge
#

i'm sure there is a way to unmess it after using analogWrite(), just need to find it

north stream
#

I'm guessing playTone() does a digital (PWM) output, which would be max volume, whereas analog output may not be.

obsidian hamlet
#

why do you need to use A0?

echo hinge
#

@north stream yes, that's exactly what i'm thinking

obsidian hamlet
#

are you using all the other pins?

echo hinge
#

@obsidian hamlet at times i just want to play tones on A0 (the speaker), and at times i want to use playSound() to play individual samples to the speaker

#

i need to use A0, since i want to target the internal speaker, which is attached to A0

obsidian hamlet
#

ah ok

#

can you look at the source code of playSound?

echo hinge
#

@obsidian hamlet i did, and i'm actually using my own implementation. but a single analogWrite(A0, …) "breaks" playSound() .

#

i can reduce the effect by adding analogWrite(0xffff) after playing the samples.

obsidian hamlet
#

your own implementation?

#

of playSound? what does that look like

echo hinge
#

but it will never get as loud as it was after boot

#

it's a copy of playSound(), but simplified a bit since for now i only play 8 bit samples

#

i'm loading an audio file from fatfs and want the loop to be as tight as possible

north stream
#

Hmm, the audio amplifier has a shutdown pin, but I doubt that's it. That leaves something like scaling.

wet crystal
#

22kΩ Baseresistor for 100 to 200ma current between collector and emitter should be fine. With BC547B transistor right?

north stream
#

Hmm, with 5V logic, a 22kΩ base resistor would put 200µA into the base. A BC547 has an hFE of 110 to 800, so would switch 22mA to 160mA. With 3.3V logic, it would be less.

#

I'd recommend a smaller base resistor.

wet crystal
#

Which size?

north stream
#

I'd suggest something in the range of 1k to 2.2k for 5V logic.

wet crystal
#

KK

#

It´s okay if i use the same size for every transistor. I make my wife a animet LED namesign

#

And every letter consums between 100- 200 ma

#

thats im asking

north stream
#

Yeah, I generally use the same size for all the transistors, if I'm running them in on/off (saturated) mode.

#

Note: if you're using 3V logic, that resistor should be smaller, perhaps 470Ω - 1kΩ.

wet crystal
#

What do you mena by 3V logic?

solar sail
#

3.3V rather than 5V supply voltage for your digital parts.

wet crystal
#

I use attiny85 so 5V is right?

solar sail
#

If you supply it 5V, yes 😃

wet crystal
#

KK

severe mango
#

I’m connecting a PN532 NFC Shield yo an Arduino Uno

#

I run the demo code and get this:

#

Lights are on and everything is connected properly

severe mango
#

I’ve checked every single solder connection with a multimeter

north stream
tough snow
#

@severe mango the solder join on the 3v pin doesn't look that great. I would check all of your solder joins for the pins to make sure they are good.

severe mango
#

@tough snow redid the 3V pin solder and checked the others with a multimeter again

#

Same result

#

i2c does recognize it

#

Is there anything special I need to do in the arduino IDE?

#

For testing sake I completely swapped the Arduino Uno I was using for a new one, same results

north stream
#

That tells me the board is powered, the I2C connections are correct, the pullup resistors are present, and the chip is responding.

severe mango
#

After about three hours of replacing everything hardware wise I realize I’m stupid

#

I forgot to uncomment a single line in the example code

#

It’s working fine now

north stream
#

Ouch. I'm glad you got it working, after that frustrating delay.

wheat kiln
#

Hello everyone, I am designing my own PCB and I will be using an ATMega32u4 chip on. This is my first time embedding an MCU directly on my board and I want to make sure I go the bare minimum setup correct. I was hoping someone can take a look at the schematics and let me know if they notice anything missing. All I need is a simple reset push button, an ICSP header and access to the digital pins. The device will communicate to the PC via USB micro connector

bleak glacier
#

@wheat kiln I'm not a board maker but have you looked at the open source designs for the arduino nanos or pro micros? They are essentially the bare bones configurations to get the chip working.

wheat kiln
#

Thanks @bleak glacier , I have indeed looked at the some, particularly the Pro Micro. To be honest, I would have not been able to complete the schematics on my own. I think I copied everything that I needed correctly. I just needed to make sure

bleak glacier
#

Someone will come around and be willing to take a look. Good luck.

north stream
#

Looks okay to me. You don't really have to ground PE2, but you should ground the thermal pad under the chip: you'll want to put a few vias there for heatsinking as well. The really fiddly bits are the USB data lines and the crystal signals: the rest is pretty undemanding.

pine bramble
#

hello

#

how can I make arduino does its loop until a condition is met then do nothing until a serial input is met then repeat that loop?

#

let's say I want to run a cleaning robot when a command is given, and when the cleaning process is finished (however I define that) i want arduino to wait for serial input to start a new one

#

I know I can condition on serial data sent

#

is it something like this if (Serial.available()>0) {

#

?

lean crypt
#

Serial.available() returns bool iirc

pine bramble
#

what i want though is to just send 1 instant serial command

#

not to have to keep the serial on while the cleaning happens

#

won't the cleaning stop midway as soon as serial is not available?

#

i want a variable that as soon as I receive a serial that variables stays on/1

#

until I myself reset it

#

i dont want it to keep checking for the serial even after

lean crypt
#

The if() checks it at the start, doesn't stop it part way through

pine bramble
#

I understand but let say I have something that keeps cleaning for 5 minute it will keep looping

#

until 5 minute is reached

#

as I get the time from now

#

I am thinking I introduce a new variable k and from set up I have k=0 but when I read serial I set k=1, and in my condition for the loop I have if serial.available &k==0

#

and when for example 5 minute pass I set k=0 again

#

would that work?

lean crypt
#

I'm just trying to clarify

int k =1;
if(k==1){
    delay(5000); // Simulate cleaning
    k=0
}
pine bramble
#

setup()

k=0

loop()
if (Serial.available()>0)  &k=0)
k=1
%cleaning%
k=0
#

I mean like this

lean crypt
#

(PS triple back tick ``` makes code nice to read)

#

yea that should work

#

surround the code with them*

pine bramble
#

yeah sec trying

#
setup()

k=0

loop()
if (Serial.available()>0)  &k=0)
k=1
%cleaning%
k=0
#

yeah thanks tho just wanted to verify 😃

lean crypt
#

I did something similar for a radio project. except it was a slightly different stream

pine bramble
#

are you an electrical engineer?

lean crypt
#

Not an engineer no, I dabbled in it. By education I'm a programmer, by trade I'm a locksmith

pine bramble
#

ah

#

Well my project is interesting, I want to try to use raspberry pi to take a picture of an object, use image processing to identify if clean or not

#

then send a command to arduino

#

to start cleaning

#

I just started it, but I think it will be fun

lean crypt
#

Neat! I really enjoy image processing

#

beware the darkhole that is tensorflow and keras

pine bramble
#

well I am more of a matlab guy than python but yeah I need to learn tensor flow for raspberry pi

#

since no matlab :X

lean crypt
#

ah you're an engineer? 😛

pine bramble
#

yeah

#

electrical

lean crypt
#

When I was in school 7 of our grad students used ML for image processing and almost all of them concluded that in majority of cases canonical image processing was a more ideal then ML

pine bramble
#

hmm really?

#

that's actually very interesting

#

I think it

#

iis more effort to define clean/dirty using image processing vs machine learning

#

especially if you are using only a specific object

#

like I plan to use it for solar panels, but I think pure image processing would not be enough

#

I think for quantitative things it's true but for qualitative things

#

ML is better

lean crypt
#
bool k = true;
void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);
  while(!Serial.available());
}

void loop() {
  Serial.println("Helloworld");
  if(k){
    // this loop imitates your cleaning cycle
    for(int i=0;i<5;i++){
      digitalWrite(LED_BUILTIN, HIGH);
      delay(100);
      digitalWrite(LED_BUILTIN, LOW);
      delay(100);
    }
    k=false;
  }
  uint8_t* pars=Serial.read();
  if(pars=1){
    k=true;
  }else{
  delay(100);
  }
}//end loop
#

I win

pine bramble
#

the question though for how long

#

should I send the serial.read?

#

I need to investigate for how long does raspberry pi send the command

lean crypt
#

mine has it set to 1 second (5x (100ms+100ms)

#

your sending from pi to arduino correct?

pine bramble
#

yes

lean crypt
#

for most computers and embedded systems I deal with I've always put arbritrary 20-100ms delay and decrease it until it breaks or remove it

pine bramble
#

i guess I need to know for raspberry pi if I put serial write does it write like for 1 micro second

#

then the signal is gone

#

or can I specify the duration of writing

#

I am hoping it's the latter obvious :X

lean crypt
#

timeouts and watchdogs are possible

pine bramble
#

what do you mean?

#

I guess what I mean is if raspberry pi sends something to arduino will it stay there till arduino reads it

#

or will arduino have to read it at exact second

#

it's sent

lean crypt
#

if you use a stream, yes

pine bramble
#

ah ok

#

that's good

lean crypt
#

read implements stream

pine bramble
#

so i dont need to worry about my command to read synching with command

#

to write

lean crypt
#

nope

pine bramble
#

it would have been a big headache ;o

#

so that's good

honest nimbus
#

If your system only needs to be reactive to serial input and can live with waiting on serial, it provides a concise and very human-readable way to do so

errant geode
#

This is my code:```cpp
#include <Adafruit_TFTLCD.h>
#include <Adafruit_GFX.h>
#include <TouchScreen.h>

#define LCD_RD A0
#define LCD_WR A1
#define LCD_RS A2
#define LCD_CS A3
#define LCD_RESET A4

#define LCD_D0 8
#define LCD_D1 9

#define TS_MINX 120
#define TS_MINY 130
#define TS_MAXX 940
#define TS_MAXY 900

Adafruit_TFTLCD Screen(LCD_CS, LCD_RS, LCD_WR, LCD_RD, LCD_RESET);
TouchScreen Touch = TouchScreen(LCD_D1, LCD_RS, LCD_CS, LCD_D0, 300);
TSPoint TouchPoint;

void setup()
{
Screen.reset();
Screen.begin(0x9341);
Screen.setRotation(1);
Screen.fillScreen(0x0000);
}``` It works on uno but not working with due.

lean crypt
#

I have to ask, you did change board type in arduino correct?

#

wait do you have a link to the actual screen

errant geode
#

Yes, i change board type, it compile, but display nothing. I try now with ILI9341_due library but still not work

lean crypt
#

What's the voltage required by the board?

fallen linden
#

Does anyone here know, is there a way from within a python script on an Arduino board to sense the state of the power source (ie battery). I'd like my IoT device to send me a warning when the battery gets low.

tough snow
#

@fallen linden Arduino doesn't run python.

fallen linden
#

@tough snow Ack, the problem with cutting and pasting a question. Of course I want to sense it from within Arduino code.

tough snow
#

Most Arduino devices have analog input pins, which can be connected to your battery before it is regulated. Precise workings depend on the device, the battery, possibly the regulator...

fallen linden
#

One of the projects I want to add this feature to is running on a Feather Huzzah. So... I can attach a battery to an analog in pin in such a way that it powers the device? I'll look around for some docs on this. Thanks.

odd fjord
#

@fallen linden the Feather Huzzah ESP8266 has one A/D input but it can only accept up to one volt so you need to use a voltage divider to bring your battery level into range. I'm looking for an example ...

#

@fallen linden I have to go offline for awhile -- I'll see if I can find the example I was looking for and post it later if you think it would be of interest.

swift acorn
#

Hey so I have an issue with Arduino not properly starting when I use powersupply instead of powerbank
the code that I'm using is from GreatScott from Youtube for 1D Pong with LEDs that I've built as well https://pastebin.com/QPW8tzPq
The issue is that when I use power supply arduino won't wait for the button press to start the game but with powerbank it does wait and it's working as it should
Any help?

north stream
#

That's a tricky one. I'm guessing it's a problem with the power ramp-up time, and/or the auto-reset functionality.

fallen linden
#

@odd fjord Ah I see. I would attach the battery to power the device as usual. But also attach it to the analog in, with a divider, and watch the battery level through that pin (adjusted for the divider). If I have that right it makes sense. If you have a sample case it'd be useful. Thanks.

nimble sky
#

Serial.println(DebugZero + (millis() - LastMillies));
Outputs: Milliseconds last cycle (Δ Time): 262170
this is at the end of loop
LastMillies = millis();
also, my temp sensor says its -11.45°C I think I have a gremlin

swift acorn
#

@north stream so can you think of any solution? I'm still noob when it comes to programming

north stream
#

You're probably going to have to do some research to see if the bootloader is getting triggered in the different circumstances, and see if it behaves the same way when switched on using the power switch instead of being plugged in.

nimble sky
#

hey madbodger, is this a better channel for my Arduino gremlin? 😃

#

i can link you its github if you want 'the big picture'

swift acorn
#

well with my knowledge I doubt I'll be able to do anything with it so I might as well stick with powerbank but thanks for info!

north stream
#

Yeah, this may be a better channel, I suppose I could paste my reply here too.

nimble sky
#

oh you dont need to 😃 i can switch to read it

#

also it was operating at 51 ms earlier

#

but i have seen it negative before as well

#

Drawer PWM: 135 ~ Cabinet PWM: 135
Milliseconds last cycle (Δ Time): 26
Temperature: -12.65°C ~ Desired: -12.95°C ~ Differential Zero: 0.30 ~ PWM Zero: 0
Relay state: Online

odd fjord
delicate jolt
#

Hello guys

#

I am trying to connect esp 8266 wi-fi module with arduino

odd fjord
#

my simple micropython code was just ``` vbat=a0.read() * 1.22/.22/1024

delicate jolt
#

and when i send the AT command to see if it works

#

i recive the following response

#

can anyone help me please?

dense kiln
#

I have a question out of my curiosity: does the millis() function count the milliseconds that passed since the board booted, started booting, or started executing the program?

eager jewel
fallen linden
#

@odd fjord Thank you. That looks like exactly what I was wanting. And I can translate to Arduino no problem. [EDIT: Now that I look closer, it seems to already be Arduino.]

velvet kayak
#

My arduino project has been moved into a cardboard box. I tried connecting more pins this time. Unfortunately, when I enable pin six, so does pin seven. It's kind of annoying. I have no clue why, the insulation is strong enough, and they aren't touching directly

#

Seems that my logic is messed up. Throwing it into a separate script where it just enables / disables pin six makes it work fine.

#

@tough snow You helped me the other day with this I believe. Do you have any clue why it's happening

#

Sending the character '6' over Serial will enable BOTH pins six and seven. It's a logic issue, not a hardware issue either.

tough snow
#

@velvet kayak You don't have a break; between case '6': and case '7':

#

Also missing one between e and f

velvet kayak
#

Sorry about having you read through my sloppy code, haha. Thanks for letting me know, I was copying and pasting the scenarios then just filling in the blanks to save me time.

tough snow
#

No worries, it's all about learning.

#

I've made that same type of mistake before. A few times. I'm sure I'll make it again eventually.

#

I've done things like that where I've spent hours poking at hardware trying to find the short only to have it be a code issue (And also the opposite!)

velvet kayak
#

Yeah, haha. Initially I thought it was a hardware issue. I did some pretty sloppy wiring. It's all over the place, and since I don't own a Soldering Iron (and I don't trust buying a cheap $50/100 one to not blow up in my face or catch on fire), it's all a bit loose. I thought maybe something was falling out, but when I looked it was fine. So I made some quick scripts to test out each pin individually, and it worked there. I knew it had to be something with my logic then.

tough snow
#

If you're willing to spend $100 on a soldering iron, go for the Hakko FX-888D - Quite a good iron, it's the one I picked up for myself a few years ago

north stream
#

Agreed. You can get a nice reliable iron for $100 or so. I have one of the older Hakko ones, and it serves me quite well. I also have an older Weller unit, which is also a fine unit.

arctic pivot
#

Weller or Hakko are both good -- my #1 suggestion is if you buy additional tips, get verified first-party ones. Don't go with third-party tips or from less-than-official sellers....you'll get unpredictable results.

Adafruit, digikey, arrow, newark, mouser, sparkfun are all good sellers.

#

A china-based seller on ebay? ehhhhhh. maybe not?

pine bramble
#

Pot metal (or monkey metal) is an alloy of low-melting point metals that manufacturers use to make fast, inexpensive castings. The term "pot metal" came about due to the practice at automobile factories in the early 20th century of gathering up non-ferrous metal scraps from t...

odd bloom
#

does anyone know any good guides to coding with arduino?

#

im new and interested

north stream
inland crag
#

I bought 10 tips for $12.50 on amazon and haven't had a problem with them

#

yet, I guess

north stream
#

I was irked when I couldn't find the genuine Hakko 900M tips my older 936 iron takes, until I discovered (via a footnote on a reseller's site) that the current T18 tips are compatible.

arctic pivot
#

That's another thing to consider -- the tips have odd naming conventions.

#

@inland crag I'm jealous, I got Amazon-sold-first-party-tips-that-totally-WEREN'T-legit that fell apart in a few weeks of casual use.

#

One of the first times that made me seriously question Amazon, but that's neither here nor there.

For the extra few bucks, I think one should have a couple of good first party tips, then roll the dice on a few "cheaper" extras.

nimble sky
#

@dense kiln I'm just getting caught up, I was away mounting the LED solution in my kitchen under the sink. and re-writing my solution, and well lots of stuff 😃 Yes the millis() returns the count of milliseconds since the Arduino started executing and i believe it is a type unsigned long.

#

Im pretty happy with my seeed soldering iron, gets up to 300°C pretty quick on an 18V supply.

#

@odd bloom You could check out the github of the project I'm troubleshooting. its very commented 😃 though im working on trying to get it working.
https://github.com/chemicalvamp/OLED_Display-BLE_Communication-LED_Lighting-Mains_Relay_Control-Winter_Cooler_AIO

nimble sky
#

please do have a look, I keep it up to date as possible. I don't know why millis() and DeltazTime aren't worming, this is the serial I'm getting: ```Milliseconds last cycle (Δ Time): 0
Drawer PWM: 100 ~ Cabinet PWM: 0
Temperature: 22.01°C ~ Desired: 23.14°C ~ Differential: 0.00 ~ PWM Zero: 0
Relay state: Online

honest nimbus
#

Line 145 SecondPass: looks like an assembly or BASIC label, not C++ code

#

oh, C has goto

#

that's valid

#

You have a potential overflow in how you handle ButtonMillisCooldown

#

every 32 seconds or so ButtonMillisCooldown will overflow back to a positive value and your button won't work for the next ~32 seconds

#

The other thing I can think of is running out of RAM. You don't instantiate the graphics library after including it, but if it's taking up a screen buffer's worth, then with that and the samples and the large number of debug strings...

#

Easy to test, thankfully

#

Just prepend your fixed string declarations with PROGMEM and they won't take up RAM

#

If they program works better, it was RAM

#

@nimble sky

#

Otherwise, I'm not seeing anything obviously wrong with the loop and it's a bit odd and frustrating

#

TemperatureFunction() should indeed be analogWrite() (line 225) instead of digitalWrite() (line 224)

#

Digital write will result in the fan being either full on or full off with any difference

#

Line 249, LightingFunction(), you need analog writes when you intend to use PWM

#

Line 259, you can accomplish this math more compactly with e.g.

#
int sign = -1;
int value  = 255;
value += sign;
if (value == 0 || value == 255) {
    sign *= -1;
}```
#

Not a necessary change by any means, just food for thought, using the state to do the calculation directly saves a few cycles and bytes of RAM, rather than tracking the state and running nested ifs.

nimble sky
#

@honest nimbus Thank you for your input, I will surely take it. I have committed some changes I would like for you to read through again when the time arises, and describe changes with the new line #'s.

thanks again: updated 1/27 2PM GMT -6
https://github.com/chemicalvamp/OLED_Display-BLE_Communication-LED_Lighting-Mains_Relay_Control-Winter_Cooler_AIO

frigid surge
#

I've been trying to send a put request from my esp8266 for a while not but I can't figure out why it doesn't work and there are barely any posts about put requests online
I keep getting errors around int httpCode = http.sendRequest("PUT", String(data));

low echo
#

hi, everyone. Have a problem with NEOPIXEL ARDUINO APA106. Everything work fine until 5-6 loops
#include <Adafruit_NeoPixel.h>
#define LED_COUNT 1
#define LED_PIN 7
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, 7, NEO_RGB);
void setup() {
// put your setup code here, to run once:
strip.begin();
}

void loop() {
strip.setPixelColor(0, strip.Color(8, 0, 0));
strip.show();
delay(500);
strip.setPixelColor(0, strip.Color(0, 8, 0));
strip.show();
delay(500);
}
after 5-6 loops, it starts blink random colors on full brightness
Same stuf with Easy Neopixel libary

swift belfry
#

using nodejs on arduino and have a relay with turns on with low signal

#

so i need to have a high signal to start with on 3 pins

#

not sure how to do it

#

nodejs with arduino*

dense kiln
#

Are the HIGH / LOW values 1 and 0, or true and false? (I'm trying to figure out how to get HIGH if LOW, and LOW if HIGH without using an if/else)

swift belfry
#
const five = require("johnny-five");
const board = new five.Board();

module.exports = function() {
    board.on("ready", function() {
        var pin8 = new five.Pin(8);
        var pin9 = new five.Pin(9);
        var pin10 = new five.Pin(10);
        pin8.high();
        pin9.high();
        pin10.high();
      });
}
#

that's the working function

#

The problem is, this runs constantly unless I attach it to a route.

#

I can't wait until the user logs onto the page, the water pumps the relays are attached to will overflow

#

and if i have them on the main index.js

#

it constantly turns them to high, therefore making it useless because I can't turn them on when i want to

#

that's the entire problem

#

Well this is embarrassing, I don't even need to reverse it, you can wire a relay in two ways. Man I feel stupid haha.

nimble sky
#

You spoke to this community about a problem, and had a solution within 12 minutes. I call that a win 😉

#

yesterday I gave it literally 12+ hours, mounted and wired LED light strips, pretty much re-wrote my entire solution frequently updated my github. still have an error I dont see with these eyes.

wet crystal
#

Hi,

since i cant figure out the problem why the Moist sensor doesn´t work on my Uno i have to use my Wemos.

On the screw terminal there is going to be a 5V Pump with 100ma.
The resistor for the transistor is a 1kΩ. The blue led should indicate, if its on or not.

The 3 pin header is wired is for my moist sensor. It isn´t supposed to run all the time, so i power it trough digitalPin from wemos.
It doens´t need much power to run, so this shoudn´t be the problem. The red led indicates if its on or not with a 220Ω resistor.

So is this right?

nimble sky
#

@wet crystal what pump did you buy, what do you think of it and link plz ;D

wet crystal
#

Cant find the original ones on ebay

#

They are okay

nimble sky
#

Ah cool i will have to have a look at them, an automated plant is a must.

#

I just got my stupid light and temperature sensor working 😄

nimble sky
#

I need to buy more Arduinos 😄 4 this time maybe

honest nimbus
#

Double check that ButtonMillisCooldown overflow issue, I don't see a change for it! Here's my low-effort suggestion, line 140:

    ButtonMillisCooldown -= DeltaTime;
}```
#

That will prevent the program from continuing to count that down and then wrapping it after ~32 seconds, causing the button to become inoperable for ~32 seconds

vestal pebble
#

and it works, but the high-low toggle is upside down. I know it is wired correctly because it used to work on the factory code

#

Joystick_ Joystick;

void setup() {
// Initialize Button Pins
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);

// Initialize Joystick Library
Joystick.begin();
}

// Constant that maps the phyical pin to the joystick button.
const int pinToButtonMap = 2;

// Last state of the button
int lastButtonState[3] = {0,0,0};

void loop() {

// Read pin values
for (int index = 0; index < 3; index++)
{
int currentButtonState = !digitalRead(index + pinToButtonMap);
if (currentButtonState != lastButtonState[index])
{
Joystick.setButton(index, currentButtonState);
lastButtonState[index] = currentButtonState;
}
}

delay(50);
}

#

Is there a way to tell the program to flip it around? Basically, right now up is down and down is up.

nimble sky
#

Oh yes thanks @honest nimbus I spent about 12 hours in the last 2 days working on this project but I missed that. Fixed a couple of problems this weekend, but i believe there is still a problem with my millis and delta time, but I did just update the github

honest nimbus
#

@vestal pebble It looks like the Joystick library doesn't handle flipping it, so you'll just have to write that handling on your own. See how the buttons read !digitalRead(...? The ! means "not." The buttons are wired as reading HIGH (equivalent to True or 1) when not pressed, and LOW when pressed. The ! inverts that for the purposes of program flow.

#

While it is easier on our brainparts for up and down to look like they "should," the actual system just... doesn't work that way, sometimes. Or it's at least much simplier to have it not work that way.

#

Write your program as if you're doing it backwards, and the two backwards-es will cancel out.

nimble sky
#
Could not find boards.txt in D:\Dropbox\Documents\Projects\Arduino\hardware\libraries\Servo. Is it pre-1.5?
WARNING: Error loading hardware folder D:\Dropbox\Documents\Projects\Arduino\hardware\libraries
  No valid hardware definitions found in folder libraries.``` ?
lean crypt
#

update libraries?

nimble sky
#

that's exactly where I'm getting that error from.

odd fjord
#

code below omitted

#

wrong channel - sorry

crystal mesa
#

Hey, all. Windows 10, Feather Huzzah ESP8266, Ardunio IDE 1.8.8, ESP2866 boards 2.4.2, drivers installed and board is showing on COM6.

#

Try to install any sketch and I get this:

#

error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

#

I have tried at both 57600 and 115200, 80MHz selected

pine bramble
#

What's the interface chip on that one?

#

Looks like CP2104.

#

Generally speaking, if you can successfully interface to CP2104, you've done (possibly) all you can do on the host PC.

#

It's a USB bridge that lets you talk to serial hardware ports on microncontroller devices.

#

Silabs makes this chip.

crystal mesa
#

Got the latest before I connected

hushed solar
#

fun new question from me for any one able to answer. is there a way (using multiple esp32s and their bluetooth) to send data between two unpaired devices or to have devices pair to eachother as soon as they "see" one another? need this or some other way for a bunch to of them to be able to communicate over a distance (in a wide open field or woods or wherever) where they will go in and out of range of eachother often but need to tell everyone nearby some data. using it for a game similar to laser tag but more for larping and without the need for a giant suit or sensors to see light from ir sensors. i already have gps, a mpu and such for getting data, just need the connecting piece (wifi,bt or such) before i build the actual game.

crystal mesa
#

Sounds like you might want to examine the particle mesh boards.

honest nimbus
#

sounds like WiFi might be better suited for that

#
  1. MAC scanning is already implemented for doing WiFi encounter counting
#
  1. longer range
#
  1. better support for ad-hoc and peer-to-peer connections
crystal mesa
hushed solar
#

The other issue is power. Would like to use as little as possible (hence the Bluetooth) but I’ll look into the WiFi sta+ap combo and see if I can get it to work that way. If you all have any ideas with what I have (hardware wise) let me know

crystal mesa
#

For my Huzzah issue, I figured it out -- had a breakout attached to TX/RX. Disabled power to that breakout and was able to upload my sketch.

north stream
#

Maybe use Bluetooth Low Energy in "beacon" mode?

acoustic nebula
#

@hushed solar see if nRF24 would solve your issues. It's very low power, connectionless and can go long distances

hushed solar
#

radio....thats a good idea though i have no idea why i didnt think of it or take devins hint about it. im an idiot lol. thanks @acoustic nebula

acoustic nebula
#

👍

hushed solar
#

hmm...wonder if throwing the radio transmitter onto the second i2c bus might prevent any issues that you ran into with yyour display

#

plus then i could put the second cpu to just doing the radio connection (and turn off the other wireless

fallen linden
#

Can anyone recommend an Arduino IDE that's a little more sophisticated than the basic one that many of us use?

north stream
#

There's always AVR Studio or Eclipse, I suppose.

eager jewel
#

You could take a look at PlatformIO. It's an add-on for the Atom Editor, but I haven't realyy played around with it much myself.

zinc saddle
#

Does "expected unqualified-id before numeric constant" mean that I have a variable that I cant define in that way. I read that one cant use something like "byte B1;". Is this true, if so what other variablenames are prohibited?

north stream
#

Something like "byte B1;" should be legal.

zinc saddle
#

What else could cause this error? The other solutions have been about missing semi-colons or points instead of decimals

#

I have Variables like byte 201aV; or byte 4v;

north stream
#

I was wrong. It turns out that the "binary" representation in Arduino isn't done by the compiler, there's a "binary.h" header file that's included that does so. It defines everything from B0 to B11111111 as integers, so they can't be used for variable names.

zinc saddle
#

Ok, but I dont have anything like that. The most similar would be:
bool 2BR;
bool 2BL;

north stream
#

I don't think variable names can begin with a digit either.

zinc saddle
#

Yeah, that was it. Thanks a lot

north stream
#

It reminds me of arguing with the old Atari BASIC interpreter, which didn't pay attention to whitespace, so if I tried to use a variable named SCORE, it would match the OR keyword and see it as SC OR E. POINT was also a reserved word, so two obvious variable names for (ostensibly) a games machine were not available.

pine bramble
#

I've got an adafruit motor shield here

#

I want to connect the stepper motor (on right) to it

#

how do I know how?

#

The wires coming from the stepper motor, how do I know which terminals to place them in, since they aren't labelled anything distinctive on the shield?

#

I'm a pretty big noob

#

It's M3, GND and M4

#

What could the M's connotate?

viral gulch
pine bramble
#

thanks

#

I have everything loaded up, I just need to know how to connect it

#

I've been looking around, but thanks for that article since I'll need it when I'm coding it later

viral gulch
#

Yep! If you have any adafruit product the learn guide should be the first place to look for usage information

north stream
#

It helps if you know whether the motor is unipolar (generally 5 or 6 wires) or bipolar (generally 4 wires).

pine bramble
#

@north stream Accel_ConstantSpeed:15:10: error: AccelStepper.h: No such file or directory
#include <AccelStepper.h>
^~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
AccelStepper.h: No such file or directory
Invalid library found in /home/matthew/Arduino/libraries/adafruit-Adafruit-Motor-Shield-library-d815040: no headers files (.h) found in /home/matthew/Arduino/libraries/adafruit-Adafruit-Motor-Shield-library-d815040
Invalid library found in /home/matthew/Arduino/libraries/adafruit-Adafruit-Motor-Shield-library-d815040: no headers files (.h) found in /home/matthew/Arduino/libraries/adafruit-Adafruit-Motor-Shield-library-d815040

#

The arduino ide is always the stop for me, it really is, I don't understand why there are ever so many conflicts.

#

Firstly, there is still documentation that suggests that I should install it manually, secondly even installing via the library manager doesn't seem to work

#

why is it so hard to attain a state?

#

so I got rid of that

#

Accel_ConstantSpeed:15:10: error: AccelStepper.h: No such file or directory
#include <AccelStepper.h>
^~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
AccelStepper.h: No such file or directory

#

where is it lmfao

#

this is terrible

#

All documented methods fail

#

so much for simplicity, my god, why can't you just use package management on Linux!

#

KiCad does it

#

What are some alternative IDEs?

#

No matter what, it's always a 20 min troubleshoot process in the arduino IDE, this is the only reason I have never actually attempted more

north stream
#

Probably the documentation that suggests you install it manually is old. The package manager does its own package management. It doesn't use the one in the host OS, as it can't depend on it (other operating systems and windows won't have the same facilities available).

#

Worse, once you install it manually, the package manager gets confused.

pine bramble
#

@north stream Worse, the official adafruit guide doesn't tell you to install a dependancy

#

and expects you to already have it

#

It expects you to already have AccelStepper

north stream
#

It's probably worth sending some feedback on the guide to point that out.

eager jewel
#

"If you plan to use AccelStepper for acceleration control or for simultaneous control of multiple stepper motors, you will also need to download and install the AccelStepper library"

velvet kayak
#

Is there a better way to do Serial Communication?

My project involves transferring state data over Serial, to an Arduino.

Upon the time of connecting the USB Device to the PC, I have no clue what the Serial Port is. Is there an easy way to find out?

I'm also a bit confused on the nature of Serial. Is it limited to physical ports? (i.e. USB 0 = COM0, USB 1 = COM1, etc) Or is it a software defined thing, like as long as the software and the arduino decide to communicate on COM6 it will work?

I need to be able to use a script to talk to the arduino regardless of which port it's on.

delicate haven
#

Hello all, So I have a goal of using arduino inputs for controlling games written in javascript, for example using a potentiometer to control a paddle, what would be the easiest way to do this?

scarlet crescent
#

Im about to make a Neopixel PCB badge. Am I overlooking anything.

#

1s Lipo to Pro Mini 3.3V through a 03962A Lipo Charger/Protection Circuit.

velvet kayak
#

@delicate haven check out Johnny-Five IO

north stream
#

@scarlet crescent you'll probably need a voltage booster to get 5V to run the neopixels

velvet kayak
#

Actually.
If the COM port is assigned by Windows, then how are you supposed to know what port is used by it? Is there some form of driver that manages all of this?

I'm currently using a machine I don't have admin on, which makes it a pain. I have my dev workstation, but I don't own a laptop, which is what I was going to test it with. Since I can't see what COM port it is without using Device Manager (which is blocked by my administrator/group policy), it'd be a pain to recompile my application for every single scenario.

scarlet crescent
#

@north stream Was hoping they would run at a lower voltage, but never personally tried.

inland crag
#

I thought adafruit was using 3.3v

bleak dirge
#

5v is the recommended supply. they can respond at 3.3v. you may be able to run 15 @ 3.3v...but 5v (with data line as close to 5v as possible) is more of a guarantee.

scarlet crescent
#

I could try and add a 5v boost converter. was hoping to keep this as simple as possible

#

just need to find a nice small converter that can handle the output.

bleak dirge
#

if you stay with the arduino pro 3.3v, be sure to include a level shifter as well. data signal needs to be close to supply voltage. or, switch to the arduino pro 5v.

honest nimbus
#

@velvet kayak Serial ports are.... Weird. This is because RS-232 serial ports are old hardware, and their integration with PC was designed in the 80s, in the ultimate "legacy" era

#

COM1 through COM4 are defined in legacy PC hardware to be mapped to a particular memory address and operated by a specific interrupt line to the CPU

#

e.g. COM1 is memory address/"port" 0x3F8/IRQ 4

#

Modern Windows and modern Linux both have quirks with how they assign USB-emulated COM ports numbers

#

Linux is probably the easiest to work around for a hobby project. If you only ever plug in the one device at a time, the emulated port will almost definitely be aliased as /dev/ttyAMA0

#

On Windows, COM port assignments are remembered per device. Which is nice if you often plug and unplug different USB devices, but bad if you want to predict from the device what port number it will get assigned in a new PC.

#

And not all USB devices are smart enough to have a UUID programmed in, so by plugging the same device into a different port, Windows might not recognize it as a device it has seen before

#

Here's a dumb solution: On the PC program side, just... go through all the COM ports. Set up a call and response to pinpoint which COM(s) have your whatsit attached.

#

Catch errors and skip ports that aren't right

velvet kayak
#

So is there a way to force a default, COM port?

#

go through... all of them. lol