#help-with-arduino

1 messages · Page 30 of 1

royal lion
#

I looked into the primary-expression error and it's because SoftWire is a type, but isn't Wire also a class?

#

Here's the software I2C library I'm using:

inland crag
#

It looks like you're missing an underscore maybe?

#

Or an equals sign

#

Adafruit_SSD1306 display = Adafruit_SSD1306(parameters) I'd expect it to look something like that

#

Not familiar with the library but I can recognize what you have isn't valid C++

#

Or at least not that I know of

#

I see that's what the example does so maybe I'm wrong

north stream
#

I had a similar issue once when using a variant I2C library (for an ATtiny based Trinket). I ended up having to hack up a header file to make things match.

north kelp
#

@royal lion Which specific Maxim heart rate sensor?

#

I2C addresses:

  • Sparkfun MAX3010x library: 0x57
  • SSD1306: 0x3C or 0x3D (depending on model, and/or jumpers)
#

@inland crag According to this discussion on StackExchange, both ways of instantiating an object are valid, and the one @royal lion is using is potentially more efficient.
https://arduino.stackexchange.com/questions/31357/library-instantiation-of-a-class-object

inland crag
#

TIL

north kelp
#

I know, huh? I didn't know either until I just looked it up. I'd been wondering what the difference was.

royal lion
#

@north kelp it's MAX30102, the Maxim reference board

royal lion
#

More info I forgot to mention: when I initialized both the sensor and the display, the sensor would work and the display would show one random character that would flicker as I brought my finger closer to the sensor. When I initialized only the display the display worked normally.

native kelp
solar sail
#

Probably the same bootloader that the Leonardo has

#

They're both atmega32u4 boards

native kelp
#

oh ok

#

arduino leonardo, Arduino Micro, or Arduino Pro Mini?

#

because i have a pro micro

solar sail
native kelp
#

oh for god's sakes

#

they didnt properly mark it is it the 5V or the 3.3V variant lmao

#

ehhh

#

on the store it says it is the 5V variant

dusty shadow
#

Anyone who has time, I am trying to get an arduino to read serial data from a Rinstrom 320 Scale Head, and then copy the string that it sends, and make a couple of buttons to reproduce the serial signal depending on the string (weight) needed at the time. I have an Uno, and I bought one of these https://www.amazon.com/gp/product/B072KJSS5C/ref=ppx_od_dt_b_asin_title_s00?ie=UTF8&psc=1

this is the scale head manual....not sure if it helps or not https://rinstrum.com/wp-content/uploads/support/R300-682.pdf

Any help would be very much appreciated, sorry for the long message.

wet crystal
#

So what´s exactly your problem?

#

Or don´t you know where to start?

dusty shadow
#

Well, I tried it without the Max232 and got a bunch of garbage, but i was worried about frying the arduino

#

When I monitor it with Putty, it shows an actual reading..

wet crystal
#

So this thing runs wireless? Or it is just a bonus?

dusty shadow
#

like 13.600 - lb

#

no the max232 is connected to arduino....it doesnt have to be wireless...not necessary at all

dusty shadow
#

ill send you a picture of what i am trying to do i have to run out and do some work for like 5-10 brb

dusty shadow
#

maybe that will help with understanding exactly what i am looking to do

north stream
#

You said you were reading from a scale head, and only passing data on when a button was pressed and a match condition occurred, but your drawing says there's no scale head? So the Arduino doesn't need to read from the scale head, just emulate one, or what?

dusty shadow
#

I just need to be able to read from one first, and then replicate that when button is pushed

#

I mean read from a scale head for 10lb, 20lb, and them 40lb and then reproduce those signals with a button on arduino

north stream
#

That should be pretty straightforward.

dusty shadow
#

I think I can figure the button and reproduction out. It just getting the arduino to read from the scale head without frying it.

north stream
#

It's ordinary RS-232 serial?

dusty shadow
#

Yea

#

Only using tx and rx currently from the scale head to the pc

north stream
dusty shadow
#

I have one of thesehttps://www.amazon.com/gp/product/B072KJSS5C/ref=ppx_od_dt_b_asin_title_s00?ie=UTF8&psc=1

dusty shadow
#

I just measured voltage at 10 volts when weight is applied so i am assuming that is going to be too high? @north stream Will the thing that I bought work or will one of the other things you linked?

north stream
#

If it's RS-232, that's a reasonable voltage, but I'm unsure why that would only be if weight is applied, unless it's not RS-232 but some sort of analog signal. However, if it is RS-232, then the knockoff converter you linked to should probably work.

#

You could try hooking up the signal and verifying that the voltage out of the converter is the expected one before hooking up the Arduino.

dusty shadow
#

that is a pic of the inside of the scale head

north stream
#

Yeah, should be RS-232. Technically a "space" can be +3V to +25V, and "mark" can be -3V to -25V, so +10V is completely reasonable.

dusty shadow
#

Oh I just meant I assume 10v is too much to run straight to arduino 😃

#

sorry

north stream
#

Right. It is too much. That's why you want the converter in-between.

dusty shadow
#

gotcha, ill see what i can do then now that I know I have the right hardware

#

thanks man!

simple horizon
#

What's the best way to power an esp32 dev board?

north stream
#

It doesn't have an onboard regulator, so you'll need a source of regulated 3.3V.

simple horizon
#

So would it be cheaper to just get one with it already?

olive vale
#

New to arduino and i wanted to make a flight stick for dcs using a mpu9250 for the x y data. Ive been doing the basics, but was wondering if a project like that would be difficult.

north stream
#

I honestly don't know what would be cheaper. You might or might not have something suitable lying around already.

#

That's an interesting approach to a flight stick. I suspect the basic implementation wouldn't be too hard, but keeping it calibrated might be tricky.

olive vale
#

Yea. dcs flight sim has quite a bit of settings for axis tuning

#

As far as tracking goes apparently there is a reset code i could link to a button when i center it.

north stream
#

I'd give it a go.

olive vale
#

Any recommendations for beginners to ardiuno to learn coding?

simple horizon
#

I don't have a lipo battery charging circuit besides on my arduino mkr4000 but I don't want to pack that away into this project that I plan on keeping for the next 6 months or so.

#

My project requirements are that it but be able to fit inside a custom pill bottle.

#

If I just need one or two capacitive touch sensors do I need the breakout board?

maiden hound
#

im just learning the basics of arduino and im trying to create a game of rock paper scissors against a computer who uses randomly generated numbers 1-3 and i was wondering how to use an if statement with multiple things in it like
if (choice == 1 && num == 3 || choice == 2 && num == 1) {

simple horizon
#

Separate the first choice and num with parentheses from the second.

#

So like this

if ((choice == 1 && num == 3) || (choice ==2 && num == 1)) {
    do something 
}
north stream
#

You can also do creative math like ```c
if (((num + 1) % 3) == choice)

simple horizon
#

you need to do a round or floor operator too.

#

nm, I'm dumb.

north stream
#

There is a fencepost error since that math works better with 0-2 then 1-3.

simple horizon
#

I saw the slash and thought division instead of remainder

north stream
#

To make it work with 1-3, you'd need ```c
if ((((num + 1) % 3) + 1) == choice)

simple horizon
#

I literally never use that operator.

north stream
#

I use it a lot for things like "pick a card" where I want a number from 0-51, I could use random() % 52

#

And for rock-scissors-paper, it's a circular relation: 1 beats 2, 2 beats 3, and 3 beats 1 (wrapping around). As soon as I see "wrapping around", I think "modulo".

#

Or (fancier yet): ```c
switch ((num - choice) % 3) {
case 0:
print("Tie!");
break;

case 1:
print("choice wins!");
break;

case 2:
print("num wins!");
break;
}

#

A side advantage of that approach is that it works whether the range is 1-3 or 0-2.

simple horizon
#

Any ideas on a low cost mcu with wireless and bluetooth that I can fit in the footprint of a 40mm square?

iron shell
simple horizon
#

which board?

iron shell
#

Uno, @simple horizon

simple horizon
#

then yea it'll work

iron shell
#

Use connections it says in description?

#

Do you think it is defective though? Some reviews say it doesn't work

north stream
#

When on a strict deadline and I want stuff that works, I order from Arrow or DigiKey.

simple horizon
#

That ^

#

Also, has anyone used the beetle esp32?

steel pagoda
#

Hey there I am just learning about microcontrollers and such... I was wondering if this would be a good place to ask questions about the ESP32, and programming it with the Arduino IDE?

simple horizon
#

Yep

zinc arch
#

its a good place if your willing to wait a day for an answer

#

but lots of people here will help

simple horizon
#

I'll do my best to answer it quickly if I know it

nimble terrace
maiden hound
#

So I tried creating rock paper scissors... What's wrong

#

char choice;

void setup() {

  num = random(1, 4);

  Serial.begin(9600);

  Serial.print("choose 1 for rock, 2 for paper, and 3 for scissors.                           ");

}

void loop() {

  if (Serial.available() > 0) {

    choice = Serial.read();

    Serial.print("you chose ");

    Serial.print(choice);

    Serial.print(" the computer chose ");

    Serial.print(num);

    Serial.print("                           ");

  }

    if ((choice == 1 && num == 3) || (choice == 2 && num == 1) || (choice == 3 and num == 2)) {

      Serial.print("YOU WIN!!!");

    }

    if ((choice == 3 && num == 1) || (choice == 1 && num == 2) || (choice == 2 && num == 3)) {

      Serial.print("CPU WINS!!!");

    }

    if (choice == num) {

      Serial.print("ITS A TIE!!!");

    }

}

loud hinge
#

What's it doing?

maiden hound
#

Not telling me if cpu wins I win or it's a tie

loud hinge
#

The character "1" is not equal to the number 1.

#

it;s knda hacky, but you could change choice to an int, and do this choice = int(Serial.read()-48);
The ASCII value of 1 is 49, subtracting 48 will get the correct number.

#

It was still giving me two extra loops on each entry though.

maiden hound
#

Ok

mystic cedar
#

So the 16x24 LED matrix draws up to 230 mA with all on, and the arduino can handle up to 200
how do i make this work?

#

if i want to power 2, do i have to buy and power a seperate arduino uno?

simple horizon
#

@maiden hound do you know how to do try catch?

#

@mystic cedar get a seperate power supply.

mystic cedar
#

im trying to run all of it off of a USB battery
preferrably just one

#

yea

simple horizon
#

Usb battery?

#

Like external battery pack?

#

Please give more detail as to what this is

mystic cedar
#

External battery pack with USB out
using it to power the arduino and another project that runs parallel

#

im trying to keep stuff lightweight as the device is head-mounted and preferrably low-heat

mystic cedar
#

somehow they got the arduino to run one

#

not sure if multiplexing reduces the current enough, but hoping for the best at this point

simple horizon
#

How many ma is the battery?

mystic cedar
#

should handle up to 2A

#

at least 1.5

simple horizon
#

Ok that's fine

#

You need a way to split the ground and power to put in the matrix

mystic cedar
#

well if only 8 pins are on per matrix at a time that caps at 57.6 mA if all on

rotund condor
#

so im trying to write code for the 4 digit 7 segment backpack. and i wanted to know if it was possible to choose which pins on the atmega to use for clck and dat

#

i currently have a board that will connect the screen the pins 23 and 24 which are analog pins, but the adafruit guide is telling me to connect those to different pins and i dont see anything in the examples about declaring certain pins for the 12c protocol,

#

if push comes to shove i can just interrupt the traces and wire the screen directly to the atmega. but id like to use the board if I can

north stream
#

Only certain pins support the hardware-accelerated I2C and SPI, but if the driver supports software ("bit-bang") I2C, you should be able to use any pins.

rotund condor
#

So I need to find out if the backpack I bought supports software i2c or only hardware-accelerated i2c?

#

i bought one of these

#

"We wrote a basic library to help you work with the 7-segment backpack. The library is written for the Arduino and will work with any Arduino as it just uses the I2C pins. The code is very portable and can be easily adapted to any I2C-capable micro."

#

does that mean hardware accelerated only?

solar sail
#

The device will play nice with hardware or software I2C

#

Software vs hardware I2C only makes a real difference to the master, the slave doesn't care.

rotund condor
#

so I guess the question is how do i write a program for the Arduino chip to use software i2c where I can declare the pins. it looks like if I just use the wire library Arduino expects me to use the specific pins.

#

is this what I'm looking for?

#

should I remove the wire library from my sketches if I'm gonnna use this?

#

also looks liek if i want to do software i2c I have to write a lot more code.

#

and this is defintiely my first project so maybe i should just defile my board

simple horizon
#

Does anyone have a option for wireless and bluetooth in the footprint of 40mm by 40mm?

nimble terrace
#

fun fact is I went to the local shop with the build, the guy didnot look at it and just and wich condo I needed.

fervent egret
nimble terrace
#

you will need a programmable chip between like an arduino or esp

#

to read the DHT11 value then apply a logic to the pump

simple horizon
#

But what's the smallest bluetooth and wifi board?

nimble terrace
#

esp01 i guess

simple horizon
#

That's not bluetooth

nimble terrace
#

so another esp

simple horizon
#

Can I program esp32 with an arduino?

#

Using the tx and rx pins?

nimble terrace
#

id love to know that, but idk

fervent egret
#

@nimble terrace I know that

#

But I need the code

#

The code to at least make the sprinkler activate

#

Anyone else can help

#

This is urgent

nimble terrace
#

lol

#

you can get help here, but you will need time and precise description of your problem; Im quite a noob, so.

fervent egret
#

Ya ik

nimble terrace
#

no datasheet of the product ?

fervent egret
#

Nope

simple horizon
#

I'm thinking about making my own board

#

There isnt a board that fits my requirements

simple horizon
#

Gave into the esp32 huzzah feather

bleak glacier
#

@fervent egret you need to figure out what kind of motor is in that water pump. Specifically the voltage it runs at and power requirements, that said, you need to safely interface it with your driver board using a power transistor or h-bridge circuit or relay so you don’t burn out the board. It is most likely a dc motor but a stepper or servo type is controlled differently as with the different wires connected to it. Good luck.

pallid pine
#

are there any cheap dual h bridge board out there that can handle 12v motors?

#

also how fast can i go with softwareserial

bleak glacier
#

Shop wisely with reliable vendors. Adafruit ,sparkfun,digikey,microcenter... any place supplying robotics parts should have what you need.
Set the baud rate in the code and test to see what works.

pallid pine
#

ok thanks

bleak glacier
#

@nimble terrace electrolytic capacitors need to be connected with the correct polarity. + to pos5v and the - lead to ground. Check and swap around to see if it works.

simple horizon
#

Seeed studio probably has some

pallid pine
#

Hey guys, im working with an esp8266 wemos d1 mini and a mpu6050 (gy521)

#

and

#

i cant seem to find a library for it with dmp

#

that is also compatible with the esp8266

#

so may i ask for help?

pallid pine
#

anyone?

#

im relatively new to mpu6050 and dmp

nimble terrace
#

@bleak glacier yeah I check that, seems fine.

#

I will build a Capacitance tester

north stream
#

@pallid pine maybe the FreeIMU library?

mystic cedar
#

but the display wont work

#

now ive tried it over my uno and MEGA

#

Ive tested 2 displays between 2 arduino units under both USB and 9v power, using varying pins and different cables

#

the voltage across the 5V line is good, but no current's going thru the matrix

mystic cedar
#

could i have gotten 2 bad led matrixes?
everything on the arduinos test well

#

ive tested continuity on all the wires i can, still no problems

#

im using the example code now and have tried combinations of different wires, different 10-pin cables, different arduinos, and different power supplies on both displays

#

no luck

nimble terrace
#

@bleak glacier I checked the condo with an arduino circuit, seems OK !

mystic cedar
#

the matrix isnt so much as lighting up

#

code is sending from the pins just fine, power levels are good, and all conditions are supposedly good for the matrix, but either both of my matrixes are broken or the example code is incompatible with current UNOs

mystic cedar
#

Ive been working on this for 4 hours now and still have no idea
everything should be working fine

#

has anyone else gotten this matrix to work as shown in the example?

visual granite
#

Anyone able to help me out - This code works flawlessly when I run it with the USB plugged in. Doesn't detect the capacitive touch when i unplug USB.

#

... I'm at a loss on how to post code lol

nimble terrace
#

you need a line with 3 ` at start and end

visual granite
#

CapacitiveSensor cs6 = CapacitiveSensor(4,6); // 1Mohm
CapacitiveSensor cs7 = CapacitiveSensor(4,7); // 1Mohm
CapacitiveSensor cs8 = CapacitiveSensor(4,8); // 1Mohm
CapacitiveSensor cs9 = CapacitiveSensor(4,9); // 1Mohm

int threshold = 300;
int list[8];
bool solved = false;
int solution[] = {1,3,1,4,2,1,4,2};

const int lockPin = 3;         // The pin that activates the solenoid lock.

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  if(Serial){
    Serial.begin(9600);
  }
  pinMode(lockPin, OUTPUT);
  cs6.set_CS_AutocaL_Millis(0xFFFFFFFF);
  cs7.set_CS_AutocaL_Millis(0xFFFFFFFF);
  cs8.set_CS_AutocaL_Millis(0xFFFFFFFF);
  cs9.set_CS_AutocaL_Millis(0xFFFFFFFF);
  if(Serial){
    Serial.print("Start");  
  }
  
  doorUnlock(500); 
}

void loop() {
  // put your main code here, to run repeatedly:
  
  while(!solved){
    long total6 =  cs6.capacitiveSensor(30);
    long total7 =  cs7.capacitiveSensor(30);
    long total8 =  cs8.capacitiveSensor(30);
    long total9 =  cs9.capacitiveSensor(30);

    //Serial.println(total9);
  
    if(total6 > threshold){
      AddToArray(1);
      digitalWrite(LED_BUILTIN, HIGH);
    }
    else if( total7 > threshold){
      AddToArray(2);
      digitalWrite(LED_BUILTIN, HIGH);
    }
    else if(total8 > threshold){
      AddToArray(3);
      digitalWrite(LED_BUILTIN, HIGH);
    }
    else if( total9 > threshold){
      AddToArray(4);
      digitalWrite(LED_BUILTIN, HIGH);
    }
    else {
      digitalWrite(LED_BUILTIN, LOW);
    }
    delay(50);
  }
}```
#

Thanks

nimble terrace
#

under Esc

visual granite
#

When I run the above code with a USB plugged in to the arduino it works great. But without the USB plugged in it doesn't detect the cap touch. My setup is - Arduino and a 12v 40ma lock soloniod powered by a 8xAA power pack. 4 metal corners of a box with a 1Mohm cap goes from a digital pin to pin4. Sketch listens on those pins for a touch and adds the number to the array. When the number array matches the solution it unlocks. I added in the LED on/off to see if it detects when no in USB and the LED never lights up when USB is unplugged....

stable forge
#

@visual granite could you show the AddToArray() code?

visual granite
#
  
  //if the current value is equal to the last value in the array (last added) bail out and don't add (duplicate)
  if(value == list[7]){return;}
  
  for(int i = 1; i < 8; i++){
    //Start at index 1 (second value in array) and move it to pos 1 (index 0), etc.
    list[i-1] = list[i];
  }
  //add newest value to end of array
  list[7] = value;

  for(int i = 0; i < 8; i++)
  {
    if(Serial){
    Serial.print(list[i]);
    Serial.print("/");
    }
    
  }
  if(Serial){
    Serial.println("");
  }
  if(CompareArrays())
  {
    OnSolve();
  }
}```
#

The lock runs an initialization in the setup function. So i know that works and it turns on. It could be a grounding issue maybe?

stable forge
#

@visual granite I was looking for any waiting on Serial on anything like that in AddToArray(). Yes, maybe grounding. Are you running a separate captouch breakout? You may need a different threshold when USB is not connected (the USB provides a strong ground). You could make up a test program that shows the cap touch value (without testing for threshold) by signaling it with an analog out, or by speeding or slowing down a flash rate, or something like that

visual granite
#

@stable forge that's a great idea! I'll have to try that.

mystic cedar
#

i still cant find any info on what could be wrong with my matrixes
has anyone else here had any trouble with the 16x24 panels?

stark rivet
#

Is this the place to post asking for help with trying to learn how to program a Hallowing?

daring plinth
blazing notch
#

(Official arduino server)

iron shell
#

So I tried to connect bluetooth via my phone & Blynk. But it keeps auto disconnecting on my phone when I leave the bluetooth settings app

visual granite
#

@stable forge That was it. Had to crank the threshold waaaay down when not plugged into usb

stable forge
#

@visual granite glad to hear you got it! How did you indicate the value you were seeing?

steel pagoda
#

Hey, I would like to start programming my ESP32 using the Arduino IDE. Is there any way to do that AND use circuitpython as the language? Or if I use the Arduino IDE am I limited to C?

stable forge
#

@steel pagoda The Arduino IDE does not support CircuitPython. We don't have a port of CircuitPython to the ESP32. We use it as a wifi coprocessor with other processors that support CIrcuitPython. The new PyPortal board is an example of this: a SAMD51 running CircuitPython, talking to an on-board ESP32 to do wifi

steel pagoda
#

I need to re-read this a few times in order to understand it. 😃

stable forge
#

And search for other Learn Guides with HalloWing projects

#

@steel pagoda do you have just an ESP32? or do you have other boards too?

steel pagoda
#

I have a wide assortment of boards. I'm good at "preparing to do stuff" less good at "doing stuff".

stable forge
#

do you have any of our M0 or M4 boards?

steel pagoda
#

My question revolves around work doing lots of stuff in python, and I'd rather use that as a language than C because it'll help me at work.

#

I don't think so, do you have a link? (I have a ton of Adafruit stuff)

stable forge
steel pagoda
#

NICE! I will check it out!

stable forge
steel pagoda
#

I have lots of Raspberry Pis too.

#

I will check it out, thank you very much for the insight!

#

OMG RIP my wallet looking at this page of compatible hardware. Soooooooooo much cool stuff.

stable forge
steel pagoda
#

My goal is to make a comprehensive weather station with air quality testing, noise pollution testing, geiger counter (eventually) etc.

stable forge
#

good luck and feel free to ask more questions later

wide lark
#

RPIs are admittedly overpowered for just sitting around reading data from sensors, but they're cheap and robust enough that I don't care 😛

steel pagoda
#

My motivation for going with a small microcontroller is that it may be possible to run it on solar/battery power.

wide lark
#

yup makes sense, that's one of my eventual goals as well. I think even an RPI Zero W could run on a solar + battery rig, but an ESP32 would be far better for sure

steel pagoda
#

I live in the SFO approach flight path. I'd like to test air quality and noise pollution. 😃

wide lark
#

oh boy, yeah your environment is rife for testing then 😄

#

I'm up in the north bay but I know the area well

steel pagoda
#

Lots of potential data. The aircraft are at 1500 feet when they go over my apartment. 😄

#

Hey cool! I'm in Foster City!

wide lark
#

wow you're right there then!

#

yeah I've lived in SF (8 years), Cupertino, Santa Cruz

#

now Healdsburg

steel pagoda
#

Yup. Sitting on my couch my GF and I had to stop our conversation when planes went over. I'm actually thinking that SFO is way over on it's noise budget, I'd like to be able to show it (but don't want it to stop, because I think SFO is under enough pressure and if I don't like it I can move).

wide lark
#

haha I'm sure they are, but I doubt they care much 😛

steel pagoda
#

Oh man I hope you were ok from the floods... I did the Vineman half up there three times. I can't imagine that river overflowing it's banks.

#

Ok, this is way OT now. 😃

#

Back to Arduino!

wide lark
#

haha so true! but thank you for asking, we were indeed ok. just barely, but ok nonetheless 😃 it was crazy! ok back to arduino 😃

#

honestly I'm a huge fan of the ESP32 as well, have been working on a Redis library for it (and other devices) so I can work them into my device ecosystem for exactly what you're talking about, better power-consumption

#

but it's hard to argue with the ease of use and development a full linux environment like the RPI gives you

visual granite
#

@stable forge I honestly just cut it down in intervals of 50 till the LED started coming on ever time I touched it.

stark rivet
#

Thanks @stable forge but that's the tutorial that I'm having problems with & needing help with.

steel pagoda
#

Wait, there's a redis library!?!!??!?!?

#

Oh good lord it looks like there is.

#

I'm going to have to crank up a redis db so I can get some experience with that!

wide lark
steel pagoda
#

Awesome, thank you!

pallid pine
#

yup ima go try freeIMU thanks

#

sorry for late reply

#

i just woke up this morning

north stream
#

I'm in and out at random, I understand.

iron shell
#

#include <SoftwareSerial.h>

#include <BlynkSimpleSerialBLE.h>

#define BLYNK_PRINT Serial

#define SECONDS(x)    (1000 * (x))
#define MINUTES(x)    (60 * SECONDS(x))

#define MOTOR_ON_TIME    1
#define MOTOR_OFF_TIME    4
#define MOTOR_PIN    A0

static volatile bool    motoron;
static byte        count;
static bool        phase;
static SoftwareSerial    SerialBLE(10, 11); // RX, TX
static BlynkTimer    timer;

static void
setmotor(
  bool    phase)
{
  if (phase == motoron) {
    return;
  }

  motoron = phase;

  digitalWrite(MOTOR_PIN, motoron ? HIGH : LOW);
}

static void
updatemotor(void)
{
  --count;

  if (count == 0) {
    phase = !phase;
    count = phase ? MOTOR_ON_TIME : MOTOR_OFF_TIME;
    setmotor(phase);
  } 
}

BLYNK_WRITE(V0) {
  if (param[0]) {
    setmotor(true);
  }
}

BLYNK_WRITE(V1) {
  if (param[0]) {
    setmotor(false);
  }
}
  
void
setup()
{
  pinMode(MOTOR_PIN, OUTPUT);
  SerialBLE.begin(9600);
  Blynk.begin(SerialBLE, auth);

  // initialize motor state
  motoron = true;
  phase   = true;
  count   = MOTOR_ON_TIME;

  // synchronize motor
  setmotor(phase);

  // start motor timer
  timer.setInterval(60000L, updatemotor);
}

void
loop()
{
  Blynk.run();
  timer.run();
}```
Anybody know what's wrong with this?
#

I did put the auth token on there. Just removed when posting

north stream
#

It's a bug in the Wiring compiler, it doesn't understand having the type on one line and the function name on the next, for the first function. If you put them on a single line, it'll fix that confusing error.

pallid pine
#

@north stream thank you for your advice man i really appreciate it

iron shell
#

If I use Blynk with Bluetooth, do I have to like have my computer with me to have it work on my phone, or can I just quickly plug arduino in and connect via phone without computer?

loud hinge
#

For the most part any sketch loaded to a microcontroller should run at power up regardless of whether there is a computer attached or not.

iron shell
#

Yes, but im using Blynk and Blynk does all this stuff in Serial monitor to connect to the phone

#

So I didn't know if I need a computer plugged in

#

@loud hinge

iron shell
#

Okay, so, I have my arduino setup to start a pump for 5 sec every min. But I want it to do that but also have ability to start pump from my phone. I want to do this with WiFi, what exactly do I buy to make my Arduino Uno work with Blynk via WiFi

odd bloom
#

i keep getting this error message when uploading a servo program

#

Arduino: 1.8.8 (Windows Store 1.8.19.0) (Windows 10), Board: "Arduino/Genuino Uno"

Sketch uses 1488 bytes (4%) of program storage space. Maximum is 32256 bytes.
Global variables use 50 bytes (2%) of dynamic memory, leaving 1998 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't set com-state for "\.\COM3"
An error occurred while uploading the sketch

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

remote shoal
pine bramble
#

i control my arduino with a raspberry pi / flask web app being served by gunicorn

iron shell
#

@pine bramble says it's out of stock

#

And I need it done before Thursday

iron shell
pine bramble
#

should, let me know how it goes for ya

iron shell
#

Okay. Gonna order off Amazon. Hope it works by Thursday!

sharp pebble
#

I'm fairly new to Arduino, just a few minor projects with python.

I know C much better than I know python, and I'm more comfortable with it.
I've heard it's possible to program Arduino directly in C but I'm curious if it's an easy switch or a big hassle to do it?

solar sail
#

I develop on Arduino boards with C, it's not too hard.

sharp pebble
#

Just thought I'd ask somebody before I blow a bunch of time just to find out it's not worth it.

solar sail
#

What Arduino specifically though?

sharp pebble
#

So with C, am I correct in thinking you don't use that simple arduino ide?

#

Well I have a handful of various Arduinos at home, I didn't have anything specific in mind yet.

north stream
#

The Arduino IDE uses "Wiring", which is a dialect of C++, which is in turn a dialect of C. As it turns out, you can feed it plain C, and for the most part it works just fine. In other words, you can just use C with the Arduino IDE and it's not a problem.

solar sail
#

For 8-bit AVR-based Arduinos, I use Atmel Studio to develop and then avrdude or an external programmer to program the chip.

north stream
#

You don't need to blow much time to try it out, just download the IDE from arduino.cc and fire it up and play with a few examples.

sharp pebble
#

I had a hackerboxes subscription and they sent me stuff way faster than I could get through it so I got several piled up before I canceled it.

north stream
#

I also have a Hackerboxes backlog 😃

sharp pebble
#

Thanks, I'll try that out when I get home. I was expecting it to be more complicated.

north stream
#

The whole point of Arduino is to make it easy to get started.

sharp pebble
#

I just figured that was all focused on Python since that's all I ever see people talk about.

#

I was much more comfortable jumping into programming in C on Raspberry Pis since that's just linux.

north stream
#

Python is a great language to learn on, and CircuitPython and Mu make it easy to get started (on boards that support it). But if you already know C, transitioning to Arduino is easy.

sharp pebble
#

cool, thanks for easing my concerns then!

simple horizon
#

Get the mkr 4000 vidor tbh

#

Program that in hdl

north stream
#

I want to, but I'm having trouble finding an OSX VHDL compiler for it.

#

The Arduino folks said they'd democratize FPGA programming with an environment everybody could use, but that doesn't seem to be out yet. 😕

simple horizon
#

I think that's more with apples closed system

pearl lion
errant geode
#

Hey. Can someone can help me wire this: forum.arduino.cc/index.php?action=dlattach;topic=406501.0;attach=180564to this: propix.com.pl/userdata/gfx/6fe9e2fcade69b54e6d4a262a16bc23c.jpgI already connect GND, VCC, LED+ and LED-, but other pins? And what library for it?

marsh sleet
#

idk if it's the right place to ask, but i wanted to use miditones to convert a .mid file into a usable file for arduino

#

but i can't understand how it work

#

when i enter it in cmd

#

but when i try using the comamnd

#

it doesn't work

#

do you guys have any ideas ?

honest nimbus
#

This is a pretty silly one, don't worry about it. You would've caught it.

#

The program is in C:\Users\Enzo\Downloads... etc.

#

You're typing its name in C:\Windows\system32

#

Just cd \Users\Enzo\Downloads\miditones-master\miditones-master\

#

then you can run it

#

@marsh sleet

marsh sleet
#

ohhh

pine bramble
#

Hi Sorry to bother im a beginner in all of this but im trying to learn so I can do my school project

#

In this video at 1:08

#

Is it possible to use 6 motors

honest nimbus
#

Yes, with additional hardware

#

If you have that exact set, the easiest thing to do would be to get two more of the driver board

#

You would have to use the extra pins on the Arduino, including the A0 through A5 pins (which can operate as digital pins, as well), and modify the program to drive those pins as well

#

Alternatively, and you'd need to look at the datasheets for this, if the motors draw less power than the driver board can provide, you could attach the motors in parallel on the outputs

#

The code to the Arduino would look the same, you'd have two banks of motors rather than two motors, but no control over the individual motors.

#

You'd also have to make sure your batteries could handle the load.

#

It might help to ask in #help-with-robotics and tell them the general shape of your robot and how you want it to move so they can advise you about power and such. I am not super great at motors, myself.

carmine halo
#

Does anyone know why a servo would constantly "click" instead of rotating? At one point I got it to rotate properly, but I feel like I've got enough power (NodeMCU + Servo w/ 2.0A output), but it continues to click regardless of what state i put it in or what command I send to it?

north stream
#

@simple horizon I don't think it's "Apple's closed system" (it's not: it's built on open source BSD), but the FPGA vendors wanting to keep their stuff proprietary and not support very many platforms while doing so, so they tend to opt to what they imagine most people are using, which they're guessing is MS-DOS.

#

@pearl lion thanks, that's the older "icestorm" open source FPGA toolchain (the newer "symbiflow" and "nextpnr" project extend this, and I'm looking at them). However, since FPGA vendors don't document the fuse maps or layouts for their newer products, these open source projects are stuck only supporting the older, documented chips. In short, it's not Apple's closed system, it's the FPGA vendors' closed systems that are impeding me.

#

@carmine halo Could be you're sending an out-of range PWM duty cycle, there's a power supply problem, it's a different type of servo, or even a signal voltage issue.

pine bramble
#

Hey sorry to bother again but I setup bluetooth master and slave today. Tomorrow I'm going to try to get my waterproof temperature sensor to transmit its data over bluetooth and display on the serial monitor

#

Is that possible? Any tutorial articles you recommend?

north stream
#

Yeah, it's possible to implement a serial link over Bluetooth. It might be worth debugging your serial protocol first (over a direct connection), then move it to Bluetooth.

timber snow
#

hey does anyone knows how to update the bootloader ? (feather nrf52840) Messed up the bootloader when trying to switch to CPY but I want Arduino back . Thanks

wide lark
timber snow
#

also do you guys know how I can set a passkey (hid service ) for the nrf52840 with Adafruit <Bluefruit.h > . I can't seem to find a keyword in the library that supports the passkey

median crystal
#

any ideas how to deal with avrdude: error: programmer did not respond to command: exit bootloader. with an ItsyBitsy 32u4?

#

Windows makes the "device connected" sound when i plug it in but it otherwise looks like a dead board.

maiden oar
#

Hey everyone,

I'm working on something using the Adafruit 1.44 inch 128x128 tft and even though everything works fine I wonder if it's normal that it shows random color noise for a split second at startup and if it's possible to get rid of it. Does anyone here have experience with this or a similar display?

Thanks in advance! 🙂

median crystal
#

Just a guess: This is what is in display memory at boot? Can you leave the backlight off until the first draw?

maiden oar
#

That's what I had in mind but I thought you'd still see it as a tft with no backlight is just darker, not completely black or am I wrong here?

median crystal
#

I've played with one of these displays on the Hallowing, but not standalone.

#

What are you driving it with? an M0 or a 32u4?

maiden oar
#

That should actually be very comparable, It's the same screen and I'm also using an ItsyBitsy M0

median crystal
#

Arduino or CircuitPython?

maiden oar
#

Arduino

#

And using the GFX library though with the experimental DMA enabled

median crystal
#

The "Graphics Test Code" is what I'm referring to on that page.

#

Other than that I have no experience to offer. I can say that mine works nicely under CircuitPython.

maiden oar
#

They don't seem to be doing anything special except for setting the backlight which is already on as it's not connected. And then a rotate after the init which is not needed in my case and I can't imagine either of them would cause the noise to not appear... I'll have to experiment with it some more I guess. Thank though 🙂

median crystal
#

I think that is your key to a refined appearance on startup.

eager jewel
#

As @median crystal suggested, it is random memory. I was just playing around with CP display drivers last night and if I only initialized part of the screen, the uninitialized part looked like that. Can you do a black fill?

marsh sleet
#

Okay i'm having multiple problem with my midiplayer. So to begin, what is the best way to read a midi file. Convert it to C or try to use a library ?

#

im planning on reading a midi file on a Mega card with a buzzer

north stream
pine bramble
#

I got my joystick module working but the switch part isn't working so I just moved on. I'm trying to have the data that displaying on the serial monitor sent via bluetooth between two master and slave hc05 modules via already paired

#

Anyone know of any good tutorials

nimble terrace
#

When was Neopixel created ?

maiden oar
#

@eager jewel I'm doing this in the setup:

tft.fillScreen(0x0000);```

And it still shows the noise for a fraction of a second
eager jewel
#

Can you try turning off the backlight prior to doing that?

stable forge
#

@median crystal which version of Windows is not working with your Itsy?

pine bramble
#

Guya

#

What is motor driver

frosty mantle
#

@pine bramble It is hardware that allows you to run and control a motor via the low current signal a microcontroller provides.

pine bramble
#

Sup

iron shell
#

I really need some help. Does anybody know how to use Blynk with the ESP-01 module? I can't get it to work and must have it working tonight

median crystal
#

@stable forge Windows10. Works with the Feather 32u4 proto though.

#

And with the ProTrinket.

stable forge
median crystal
#

Weird question: Is there any way to keep the M0 boards from presenting the storage on USB connect. I am trying to create a HID peripheral for a machine which must block all USB storage. I programmed it up in Arduino rather than CircuitPython on the off chance it could go straight to emulating the mouse/keyboard. Alas, it still shows up as USB storage and gets blocked.

#

@stable forge Yes, alas, I don't get the pulsing LED on RST

#

And hitting RST during upload doesn't seem to address the issue.

stable forge
#

@median crystal the UF2 bootloader will present as storage. You could use a regular Arduino bootloader

#

@median crystal do you have a Mac or Linux to try it on, to see if it's the board or the host?

median crystal
#

I have a Mac, and the board does not present to the Mac.

#

Ah. The ItsyBitsy that is.

stable forge
#

then sounds actually broken. Did it ever work? Sometimes the USB connector solder joints can get cracked. Or it may simply be bad. Is it the 3v or 5v one?

#

do you see 3.3v on the "3V" pin when it's plugged in?

#

that would tell you whether the voltage regulator is working

median crystal
#

It is the 3V. I just pulled it out of "inventory" and broke the seal on the shipping bag yesterday.

#

I do see 3V beteen G and 3V pins. The whack-o part is that Windows does the "device connected" chime when I plug it in.

stable forge
#

do you see a port in Device Manager?

#

and it definitely says "32u4" on the board?

median crystal
#

Actually it shows up under "Atmel USB Devices" as "ATmega32u4" in Device Manager.

stable forge
#

i will see if I have one to try on windows. Does the Win machine have Atmel Studio installed, and/or was it upgraded from Windows 7? Maybe an old driver is usurping things?

#

but doesn't explain why it doesn't work on Mac either

median crystal
#

The machine never had Windows7

#

Settings Add/Remove does not list Atmel Studio. I presume that is Atmel's programming tool suite?

stable forge
#

yes, was just wondering if you'd installed some possibly competing drivers

#

ok, found one to try

median crystal
#

OK, just tried again for the umteenth time and got a slightly different error message: ```Arduino: 1.8.5 (Windows 10), TD: 1.42, Board: "Adafruit ItsyBitsy 32u4 3V 8MHz"

Sketch uses 7892 bytes (27%) of program storage space. Maximum is 28672 bytes.
Global variables use 256 bytes of dynamic memory.

avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
Found programmer: Id = "þ"; type = ¸
Software Version = i. Hardware Version = .O

avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: leave prog mode```

#

This "did not leave prog mode" is new.

stable forge
#

mine simply says"USB Serial Device", not Atmel. Try right-clicking on the port in Dev Mgr, do Uninstall Device, and check the box that says to uninstall software

#

if there's no checkbox in the unstall dialog. let me know

median crystal
#

What would the phrase responding avrdude: error: buffered memory access not supported. Maybe it isn't a butterfly/AVR109 but a AVR910 device? avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check.
imply? What is AVR109 vs AVR910?

stable forge
#

it's some atmel terminology; googling shows other people with similar errors sometimes

#

has to do with 32u4 vs bog-standard arduino, I believe

median crystal
#

some indicate changing programmer under tools helps but others indicate this is ignored when programming over USB. Any insight?

stable forge
#

it shoudl be ignored

#

did you try uninstalling the driver?

median crystal
#

Um. I don't recall installing a driver. Let me check.

stable forge
#

Here's my avrdude command line from the arduino log window

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -PCOM28 -b57600 -D -Uflash:w:C:\Users\Dan\AppData\Local\Temp\arduino_build_172630/Blink.ino.hex:i 
#

please do try as I wrote above

#

is your avrdude line equivalent?

north stream
#

Try -c usbtiny?

stable forge
#

is the port you want checkedboxed in the Port dropdown

median crystal
#

How do I bring up the log window?

stable forge
#

I just mean the orange-on-black window on the bottom. In there is an avrdude command line similar to what I showed above. You may need to turn on verbose upload logging in Preferences

pallid pine
#

um

#

im having a problem

#

it seems i cant upload any form of code to my nano

#

everytime i upload it just takes an infinite amout of time to do so

#

and it will just not upload

#

even after an hour

#

it still says "uploading..."

median crystal
#

Ah. The window at the bottom doesn't give my a log of commands run to do the build.

#
Global variables use 256 bytes of dynamic memory.```
#

That's what I get.

pallid pine
#

oh

median crystal
#

The port I want is properly checkboxed.

pallid pine
#

go to preferences

stable forge
#

go to File->Preferences, check the box that says "Show verbose output during upload"

pallid pine
#

yea

#

i think my nano is broken

stable forge
#

@pallid pine it should only take a few seconds, not an hour

pallid pine
#

i know

#

its sure broken

stable forge
#

see the comments about the bootloader

pallid pine
#

i know it has a bootloader

median crystal
#

Oh my. That's... a lot of info. I might suggest pasting that into the dialog might not be desireable.

stable forge
#

just find the avrdude command line

#

paste it into an editor and search for that line if necessary

pallid pine
#

i uploaded like 10 codes to it before and it does it fine

#

but after that,

#

it keeps looping

median crystal
#

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Lee\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Lee\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Lee\Documents\Arduino\libraries -fqbn=adafruit:avr:itsybitsy32u4_3V -ide-version=10805 -build-path C:\Users\Lee\AppData\Local\Temp\arduino_build_236377 -warnings=none -build-cache C:\Users\Lee\AppData\Local\Temp\arduino_cache_778741 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\Lee\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino14 -prefs=runtime.tools.avr-gcc.path=C:\Users\Lee\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\5.4.0-atmel3.6.1-arduino2 -prefs=runtime.tools.arduinoOTA.path=C:\Users\Lee\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.2.1 -verbose C:\Users\Lee\Documents\Arduino\StayAwake\StayAwake.ino

#

Followed by:

stable forge
#

@median crystal please searc for a line with "avrdude", not just avr

pallid pine
#

ok thanks

#

but it doesnt output any error

median crystal
#

These are the only two lines containing the string "avrdude" (in the -prefs=... command line option)

stable forge
#

it will start with C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude

pallid pine
#

maybe because its a chinese knock off

stable forge
#

@pallid pine could be a number of things, some have a different USB interface (CH340, I think)

pallid pine
#

no no no

stable forge
#

@median crystal please do try to uninstall the driver, as I instructed above

pallid pine
#

the drivers are installed correctly

#

and

#

i uploaded code to it before

#

and it works fine

#

until that happened

#

well its only 2 bucks

#

its probably corrupted

stable forge
#

@pallid pine, try clicking the reset button during upload. That's the last thingI can think of to try.

median crystal
#

Driver is gone now.

pallid pine
#

i tried it

#

doesn't work

#

weird

stable forge
#

@median crystal, so now unplug and replug, and see what shows up in Device Manager

pallid pine
#

i dont see any fried components on the board either

#

also

#

windows 10 should automatically install the drivers if i finds one

#

if it doesn't it should show up as unknown devices

median crystal
#

@stable forge No more Atmel category. It shows up under "Other devices" as "ATm32U4DFU"

#

@stable forge Now I have an avrdude line that looks like: C:\Users\Lee\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino14/bin/avrdude -CC:\Users\Lee\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino14/etc/avrdude.conf -v -patmega32u4 -cavr109 -PCOM1 -b57600 -D -Uflash:w:C:\Users\Lee\AppData\Local\Temp\arduino_build_236377/StayAwake.ino.hex:i

stable forge
#

the COM1 is suspicious, it's unlikely to be that port

north stream
#

I still think it's the -cavr109 option that's the issue.

pallid pine
#

com1 is most likely the com port on your motherboard

#

i disabled it in bios so that it wont confuse me

stable forge
#

@north stream, no, my successfull upload has -cavr109
Here's my avrdude command line from the arduino log window

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -PCOM28 -b57600 -D -Uflash:w:C:\Users\Dan\AppData\Local\Temp\arduino_build_172630/Blink.ino.hex:i 
median crystal
#

@stable forge I felt the same way about COM1. However, it does go to a direct motherboard USB2 socket. And it does work with my Fether32U4. My other choice is COM57, which does not solve the problem either

#

@north stream How does one change the -cavr109 option?

stable forge
north stream
#

That's what folks were getting at earlier when they were asking if the programmer was automatically set, or the IDE was paying attention to the value in the dropdown menu.

stable forge
#

then plug it back in, and wait for it to reinstall. You should see a new COM port there. If you unplug the board, that COM port will go away, so you can identify that it's the correct one, and choose that one in the Port menu

north stream
#

You can, of course, run the command directly yourself and put any value you like for the options. I've done some debugging that way.

stable forge
median crystal
#

@stable forge I can believe that, as the problem follows the device to a Mac as well.

#

Anything I can do about it?

stable forge
#

directions in the post after that about replacing the bootlaoder, except you need to use the 3V bootlaoder, not the 5V bootlaoder

#

I can't seem to type "bootloader"

median crystal
#

@stable forge What I am seeing is "send a note to support to get a replacement". Haven't seen anything yet about replacing bootloader yet...

median crystal
#

Got there!

stable forge
#

actually, be careful with those instructions. If you use a regular arduino, you'll fry the itsy, because it's 3.3v and the arduino is 5v

#

you could use another 3.3v 32u4 board

median crystal
#

OK, can I use my Feather 32U4?

stable forge
#

yes!

median crystal
#

@stable forge Thanks for the link to the Hex file!

stable forge
#

good luck with all that!

rough sky
#

anyone around to help me? i have a trinket + 16 neopixel and the color orange isn't working (everything else is)... driving me nuts 😦

median crystal
#

Thanks. This is the most daring thing I will have ever attempted with an Atmel.

stable forge
#

@rough sky what color are you getting instead of orange?

rough sky
#

yellow

#

i tried 0xCC6600 0x994C00 0xFF8000 and all seem to come to the same shade of yellow

stable forge
#

try ffa500

rough sky
#

exit status 1
'ffa500' was not declared in this scope

stable forge
#

0xFFA500

rough sky
#

oops yeah saw it haha

#

yellow

#

maybe a bit darker yellow, hard to tell

stable forge
#

I'm not sure you're going to get a successful orange. do pure R, pure G, and pure B work fine?

rough sky
#

yepp

#

im using the same hardware and code as someone else and his is like orange orange....

#

so no idea wth im doing wrong

stable forge
#

ok, just wanted to check it wasn't an RGBW set of neopiels as opposed to RGB

rough sky
#

lemme pull the invoice

stable forge
#

yes, check the part number

rough sky
#

NeoPixel Ring - 16 x 5050 RGB LED with Integrated Drivers PID: 1463

#

on the back of it says WS2812

#

i just tried red, blue, green, white and they are all 'pure' colors

#

// Color table:
// 0xFF0000 = red 0x00FF00 = green 0x0000FF = blue
// 0xFFA500 = light yellow orange 0xFF8000 = orange 0xFF9933 = white orange
// 0xCC6600 = more orange 0x994C00 = darker orange

#

thats in the code, i tried those variations, anything that says orange is yellow

stable forge
#

could you upload your program file? use the + button on the left

rough sky
stable forge
rough sky
#

clear, no yellow yolk

stable forge
#

I would suggest you ask in https://forums.adafruit.com, and maybe include some pictures of both rings. There may be variations in the neopixels that I am not aware of.

rough sky
#

yes i posted there, waiting to see if anyone grabs

stable forge
#

ok, thanks, we're a bit shorthanded in forum support this week: someon's on vacation

rough sky
#

yeah i get it, just trying to get those dozen things done and shipped off... wasn't expecting this setback lol

#

been at it since last night >.>

#

i mean even when it switches to the red its working fine... so really confused why orange isn't working

stable forge
#

i'll try on my CPX

rough sky
#

i got IDE setup properly AFAIK... i got the libray, board selected to trinket and then programmer: USBTINYISP

#

there's other people that have confirmed it works from what i can tell

stable forge
#

if th yellow is varying when you change the color value, then I think you're fine with the uploading

rough sky
#

ill try again, very hard to tell (its just blinding to me haha)

stable forge
#

have you seen orange in person?

rough sky
#

i saw a bunch of differnet photos

#

its orange, no way around it

stable forge
#

a photo is not what your eyes see

rough sky
#

yeah but 30+ photos from random/different people...

stable forge
#

have you taken your own photos?

rough sky
#

yepp looks yellow

#

this neopixel should be able to do orange right?

#

i just tried 3 different settings... it all looks like a solid yellow to me btw

stable forge
#

how about 0x200500, try that and tell me if it looks orange (I am color-blind, so I'm not a great judge)

#

or 0x2001000

rough sky
#

so huh thats a weird one

#

0x200500 is like one moment yellow the next weak red almost orange

stable forge
#

you mean it's flickering?

rough sky
#

yes

#

hmnnn but why so many shades

#

trying 0x2001000

#

0x2001000 is green

stable forge
#

sory 0x2010000

rough sky
#

no colors lol

#

oh wow

#

wire broke

#

lemme fix that...

#

really not impress with the amazon wires...

#

testing

stable forge
#

too many zeros: 0x201000

median crystal
#

I don't mean to interrupt, but color is my day job. Color perception is tricky. Yellow is typically the same amount of red and green. Orange is more red than green, and most people have trouble discerning "orange" if the red is close to full up. Neopixels are also not capable of generating all colors the human eye can see. I would suggest starting with green just barely above the threshold where you "see" the green, then bring red up until you get an "orange-ish" hue. Then increase them together to get the brighness you want.

stable forge
#

that's very helpful: i'm protanomalous, so I'm not much help

rough sky
#

so flicking again

#

yellow to kinda orange to almost red

#

i need to edit more in the code i'm guessing?

median crystal
#

Neopixels flicker if there is any delay in the loop btw.

rough sky
#

uint32_t color = 0x201000, // Current color... start orange

#

that's what i'm changing

#

i'm guessing i have to find all original 0x994C00 and replace it with the new color, right?

median crystal
#

I'll take a look at your "ShoulderBeacon" code. I just scrolled back in the conversation.

rough sky
#

tyvm

stable forge
#

the program is lreatively complicated in terms of color changing. you might try a simpler program at first to get the colors to be what you want

#

I'm sorry - I have to 💤, but sounds like you can talk together if you're willing

rough sky
#

yeah but its suppose to do a few things, it has the pulsing orange, then the circling orange and then randomly goes red or green

stable forge
#

there are 0x994c00's in the lower loop, so you need to change all the colors everywhere. YOu might set some constants or some #define's to be the color values you want, and then use names instead of hex values in the rest of the program. Then you can change them uniformly

#

e.g. #define ORANGE 0x994C00, and then do color = ORANGE in the switch statement, etc.

median crystal
#

In order to keep neopixels glowing a consistent rate I would advise against the use of "delay()" calls. One pattern I use is to loop as fast as possible, and call different code based on the elapsed time, rather than doing work delay(50) work calls. I can paste some code if you like.

rough sky
#

im trying find and replace all

stable forge
#

then if you want to change the ornage value, just change it in one place

rough sky
#

if that fails maybe a simple pulsating orange for the code and they should be happy with that lol

median crystal
#

You probably should not be adjusting the "brightness" with pixels.setBrightness() but by adjusting the RGB values you pump into the setPixelColor()

rough sky
#

the find/replace all did very little in change lol

#

its breahting yellow then a quick orange and then a quick red

median crystal
#

In the background, the Arduino code is pulsing the neopixels for you. The delay() calls circumvent the driving of the neopixels that the Arduino library is doing for you.

rough sky
#

ah ok

#

honestly i was given the code like that and told 'it works' and many others said it works... and i bought the exact same hardware and wired it the same way

#

soooo very confused lol

#

ok so i tried 0x200500 and replaced all the old color with it

#

it's like... almost working

#

it goes from dark yellow to shades of oranges/red... im guessing thats the delay issue you mentioned?

median crystal
#

Ok, here's my magic code for doing interval-timed work ```void do_a_thing(unsigned long now)
{

define UPDATE_RATE 30

static unsigned long next_update = 0;
if (now < next_update) return;
next_update = now + UPDATE_RATE;
// Awesome code done periodically goes here
}

unsinged long start = millis();
void loop()
{
unsigned long now = millis();
unsigned long elapsed = now - start;
do_a_thing(now);
}```

rough sky
#

ohhh ty, not 100% sure what to do with it

median crystal
#

Looks like you want to change your colors every so many seconds. The "UPDATE_RATE" is the delay between changes.

#

The loop runs as fast as possible, leaving time for the neopixel driver to do the work. Your "do_a_thing" only does work when the "timeout" arrives.

rough sky
#

well to keep it super simple... i want it to etheir breathe or do a circle in orange, thats the basic thing. Maybe if possibly randomly switch to all red for a few seconds, thats it haha

#

im using ther 16 neopixel ring

#

my old one i wire in a bunch of orange led but its on or off which is super lame, with the ring i saw people were doing more intricate thing, in my case the code is suppose to do a almost breathing effect in orange

median crystal
#

OK, so write a "breathe" function that adjusts RGB up/down a little each time it is called. The UPDATE_RATE is how fast you want the "breathe" to happen.

rough sky
#

that's exactly what i thought the code i have

median crystal
#

Let me look closer....

rough sky
#

it all works fine except the color defined as orange is showing up yellow

#

i mean even when it goes to green, blue, red thats working perfectly fine

#

0x994C00 is basically showing as yellow instead of orange

median crystal
#

OK, if it ain't broke, let's not try to fix that. The "flickering" you described was someting I got from doing delay() calls in my code. The code I pasted is how I dealt with that.

rough sky
#

yeah thats only happening because i swap 0x994C00 which is suppsoe to be orange to what dan kindly suggested

#

so i think i need to try other color codes to find what is actually orange... but i have no idea what to try

#

the code itself has a variation, more orange, orange, darker orange... all look yellow

median crystal
#

I would suggest the other interface to setPixelColor: setPixelColor(pixel_index, r, g, b)

#

That makes it easier to adjust and see what looks right.

rough sky
#

right now i see setPixelColor(i, 0) in the code in multiple parts

median crystal
#

Alternatively: color = r<<16 | g<<8 | b should give you the same thing, then call setPixelColor(pixel_index, color)

#

Let me work up an example...

rough sky
#

do i put that in // color table:

#

?

#

thank you

#

im unfamiliar with this, i was pretty much told 'here's the hardware needed and the code' and then was up to us to 3d print the casing and wire/install everything

#

ok so i just tried 0xFFFF00 which is yellow and it comes off as a yellow with a hint of green

#

0xFFFF00 which is orange comes off as yellow with a hint of orange

median crystal
#

Here's something that may make color exploration easier: ``` unsigned char red = 127; // half red
unsigned char grn = 100; // under half green
unsigned char blu = 0; // no blue
int color = red << 16 | grn << 8 | blu;

pixels.setPixelColor(i, color);

#

This makes it easier (for many of us) to pick values for each of the red/green/blue and get it into a single color value. This way you can "see" what the green part is without having to look at HEX code for the whole color.

#

And the color values are in the range 0..255

rough sky
#

ah ok, where do i put this in the code then?

#

i can't even find a color chat for the neopixel...

#

how does it know 0xFFFF00 = yellow?

median crystal
#

Since you are picking a color, I would put it at the end of setup() until you know what you want. So... Try adding this to the end of your setup(): ```void setup()
{
....
for (i=0 i < 16 ; i++) {
unsigned char red = 127; // half red
unsigned char grn = 100 + 2 * i; // under half green
unsigned char blu = 0; // no blue
int color = red << 16 | grn << 8 | blu;
pixels.setPixelColor(i, color);
pixels.show();
delay(50);
}
}

#

where the ... is the code already there.

#

Oops. Bug. Stand by....

rough sky
#

0xFF8000 which is a deep orange shows up as a darker yellow lol

#

ok let me try that ray

median crystal
#

Too much red.

#

Try this: ``` for (i=0 i < 16 ; i++) {
unsigned char red = 127; // half red
unsigned char grn = 100 + 2 * i; // under half green
unsigned char blu = 0; // no blue
int color = red << 16 | grn << 8 | blu;
pixels.setPixelColor(i, color);
}
pixels.show();
delay(50);
}

#

This will set each pixel to a different shade. You want to start with less than FF for the red value.

#

FF = 255

rough sky
median crystal
#

Yes!

rough sky
#

i should try that?

#

trying to understand what to do, pushing midnight now but gotta get this done and shipped tomorrow... and there's 11 more units haha...

median crystal
#

Meh. You are just looking for a color, not trying to reproduce a lot of them. I would start with half red and run the green values up and down in groups of 16 (the number of your pixels) until you find the color you want.

#

But it won't hurt to do the gamma table they show. You don't seem to be wanting to do bulk gamma correction, but rather "find an orange you like"

rough sky
#

correct

#

im guessing im not putting the code correctly

#

i get an error

#

exit status 1
'i' was not declared in this scope

#

i put your code right bellow void setup() {

median crystal
#

My bad. That should be for (int i=0 ; i < 16 ; i++) {

rough sky
#

exit status 1
expected unqualified-id before 'if'

#

am i suppose to delete the old code?

median crystal
#

If?

rough sky
#

#ifdef AVR_ATtiny85 // Trinket, Gemma, etc.
if(F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
pixels.begin();
pixels.setBrightness(default_brightness); // Set to standard brightness
prevTime = millis();
}

#

thats the old part, it needs to go?

median crystal
#

Hang tight a moment...

#

Are you using an ATtiny85?

#

Trinket/Gemma?

#

If not, then the "if" line can go.

rough sky
#

trinket

#

btw i tried 0xFF0080 i found online as pink... yeah its a beautiful pink

#

so ONLY orange isn't working.... from what i can tell

median crystal
#

You just need to find the proper red/green values for the orange you are seeking then.

inland crag
#

You’re trying to program some cool LED effect but keep getting these weird not-quite-right colors. Maybe you’re trying to mix orange (say 100% red, 50% green) but the LEDs show yellow instead. What gives?

#

quoth the article

rough sky
#

yeah im reading the article, im unsure where do i put that big table?

median crystal
#

Yep. And the first thing is that "Orange" is subjective based on the light in the room and the color around it. Most folks won't see "Orange" when red is FF. Thus My suggestions for the colors. Try this setup() ```void setup() {
#ifdef AVR_ATtiny85 // Trinket, Gemma, etc.
if(F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
pixels.begin();
pixels.setBrightness(default_brightness); // Set to standard brightness
prevTime = millis();

for (int i=0 ; i < 16 ; i++) {
unsigned char red = 127; // half red
unsigned char grn = 100 + 2 * i; // under half green
unsigned char blu = 0; // no blue
int color = red << 16 | grn << 8 | blu;
pixels.setPixelColor(i, color);
}
pixels.show();
delay(50);
}```

#

Your red needs to be at or below 200, and your green needs to be somewhat below that (probably at least 10 to 20 lower).

inland crag
#

try 30 green 255 red

rough sky
#

i replace all of this?

#

void setup() {
#ifdef AVR_ATtiny85 // Trinket, Gemma, etc.
if(F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
pixels.begin();
pixels.setBrightness(default_brightness); // Set to standard brightness
prevTime = millis();
}

median crystal
#

Yes.

rough sky
#

done

#

looks the same

#

maybe a tad darker yellow

median crystal
#

On all of them?

rough sky
#

all are the same

#

and they breathe as they are suppose too

#

@inland crag how do i try that? all i see are options of 0xFF8000 and variants

inland crag
#

0xff1e00

#

0x1e = 30 0xff = 255

median crystal
#

OK, change the 100 + 2 * i to be 90 + 10 * i and see if you can see a difference in the individual pixels.

rough sky
#

@inland crag wow mate thats like orange red

median crystal
#

@inland crag I would suggest bringing the red/green down. Too bright and "orange" becomes "yellow" for most folks.

rough sky
#

like almost there

median crystal
#

All the same, or do you see a difference in the individual pixels?

inland crag
#

I just looked at the table, halfway through was 30, which is the gamma corrected value for 50%

rough sky
#

i reseted the code swapped their orange for 0xff1e00

#

and now instead of yellow its like orange red a bit too red

median crystal
#

@inland crag Ah! yes. Good poitn

inland crag
#

try 0xc81e00

#

200 instead of 255

rough sky
#

BINGO

#

thats orange

median crystal
#

Yee haw!

rough sky
#

ok so the big quesstions

#

i have a dozen of those to make

#

each will need different color code!?????

inland crag
#

nope

median crystal
#

Nope

rough sky
#

ouf

#

i was about to lose it haha

#

well gentlemen

#

you saved my bacon

median crystal
#

Glad it worked out.

rough sky
#

yeah this is work so important haha...

median crystal
#

Good luck. Have fun. Some of us are gonna hit the sack now.

inland crag
#

I'm 3 hours behind so I'll be around for a while longer

rough sky
#

yepp Ubisoft should be happy now! big thanks to the 2 of you 😃

#

12:27am... the night is young... need to finish all of them lol

median crystal
#

my pleasure. Say hi to Ubisoft for me.

rough sky
#

will do if they fly me over to their HQ.... hahaha....

median crystal
#

12:27. I have to be up at 0600 Ugh.

inland crag
#

seconded (re: pleasure and ubisoft)

rough sky
#

0700 for me...

#

then back in the shop for more work

proud cloak
#

Hi folks, is there a way I can for an arduino leonardo to do usb re-enumeration?

daring marsh
#

@proud cloak ugh probably not but you can try SerialUSB.end()

proud cloak
#

Oh didn't know about that, I'll try thanks

median crystal
#

Has anyone flashed a bootloader using a feather (as the "ISP")? I want to try to resurrect an ItsyBitsy 32u4 by flashing a bootloader. I have figured out the pins to connect (pwr,gnd,Mosi,miso,sck,rst) on the itsy based on https://www.arduino.cc/en/Tutorial/ArduinoISP but on the feather should I connect 11,12,13 or Mosi,miso, sck?

pine bramble
#

Hi I need some help.

#

sorry to bother

#

but has anyone used this:

#

with a pushbutton

north stream
#

I've used a few debounce libraries, but not that particular one.

maiden hound
#

How do I get a random number and I mean completely random between 1 and 12

pine bramble
#

Hello guys! Have someone worked with ESP8266 wifi module with arduino?

true star
#

Completely random has a few different definitions.

#

I've used the esp8266 with Arduino.

pine bramble
#

@true star how do you configure it? I have watched a lot of tutorials but none works

#

I use an arduino mega

#

Module is ESP01

true star
#

Oh, I've only used the ones already on their own breakout board.

#

I haven't programed them with another Arduino.

north stream
#

You can use random(12) + 1 to get a pseudo-random number from 1 to 12.

wide lark
#

@maiden hound there is no such thing as "completely" (a.k.a."truly") random from a computer without a source of actual randomness. otherwise, you're always getting psudeo-random numbers generated by a formula

pine bramble
#

@true star you meant genuino?

north stream
true star
#

No just something like the node MCU

pine bramble
#

Mmmmm

#

D:

#

Well if someone knows, let me know

#

Im having a lot of problems with this

true star
#

It uses the 12E and has a programmer. I didn't get those older small ones to work.

north stream
#

Like an ESP-01?

pine bramble
#

@north stream yes!

true star
#

Yeah he's trying to program it with a mega.

pine bramble
#

Yea! To get access and see if the module works

#

I tried with nano but it didnt worked

north stream
#

If it's still loaded with the default firmware, you can send it "AT" style commands serially.

pine bramble
#

It gave me this error

#

error: espcomm_upload_mem failed

#

Using Board: As a generic espmodule

north stream
#

What upload speed are you trying?

pine bramble
#

Also when I open the serial monitor, it showed me someting like this:
current time:??????????????????????? x

#

Upload speed O.o?

#

How do I know my upload speed?

north stream
#

Hmm, sounds like the serial monitor has the right speed, but I don't know if that's the same as the upload speed (probably not).

#

Upload speed is set with the Tools -> Upload Speed pulldown, I think.

pine bramble
#

Oh

#

You mean the baud? Its on 11500

#

That should works

#

On this kind of modules

north stream
#

There should be more messages on the scrollback giving some details of the programming process.

pine bramble
#

Oh yea

#

error: espcomm_sync failed
error: espcomm_upload_mem failed
The same message like 3 times xD

#

OM

#

G

#

The blue led turn on

#

After the upload error

#

Also it keeps showing me the error

#

But

#

It turn my led on

#

Mmmm

#

Now its sending me a lot of errors

#

xDDDDD

north stream
#

Weird. I vaguely remember you have to do funky things with a couple of the I/O pins to put it into programming mode.

pine bramble
#

D;

#

aghh my brain hurts

#

Can anyone help me with sending some data over two bluetooth modules?

#

Both are hc05

north stream
loud hinge
#

iirc there are two models of those modules. It's been a few years since I used mine, but I seem to recall that I had to look up a different data sheet with some slightly different instructions.

pine bramble
#
 unsigned char i;
 for (i = 0; i < length; i++)
   digitalWrite(pins, state);
}

why is this getting spit back from the compiler? i don't understand what

src/poofer.ino:36:28: error: invalid conversion from ‘unsigned char*’ to ‘uint8_t {aka unsigned char}’ [-fpermissive]
    digitalWrite(pins, state);```

means nor goes any googling really help me understand..
wide lark
#

@pine bramble pins is an array (really, a pointer), but in your call to digitalWrite you're passing it in as the pin

#

I think you want digitalWrite(pins[i], state)

pine bramble
#

@wide lark thank you. been a long day, heh

wide lark
#

@pine bramble haha, you're more than welcome! I feel ya, so I'm happy I could help 😃

pine bramble
#

Guys

#

Need help with module esp8266

chrome star
#

@pine bramble what flavour of 8266? what kind of board/module? i've run into those messages quite a few times, it's usually GPIO0/2/15 aren't pulled where they need to be; or com parameters aren't right.

pine bramble
#

Yep! Module ESP-01 wifi serial.

#

@chrome star

#

With arduino uno

#

I can’t get connection

#

And even I don’t know if it works

chrome star
#

@pine bramble gpio2 pulled high? level shifters? uno is 5v, esp is 3v3.

nimble terrace
#

Hey, is there some code exemple for button click detection, actions like : single/multi click, short/long click, ramping, multiple button pressed same time, etc ?

pine bramble
#

Nerd resources for learning robotics with Arduino

#

Like programming and electrical

#

Dm me please!!!

marsh cloak
rapid warren
#

hey I am creating a bluetooth controlled car using Adafruit Feather 32u4 Bluefruit LE and was wondering if anyone knew of any help guides for using arduino?

#

I am trying to write a program the allows motors on a stepper to move forwards and backwards

pine bramble
#

Flora is 32u4AU and there's a corresponding bluefruit module for it.

#

I would imagine you send signals via TX/RX pair to the parent 32u4 micro, which then does stuff in the real world.

rapid warren
#

thank you so much i really appreciate it

pine bramble
#

my arduino is freaking out. idk what is going on. have a pin that reads low regardless if anything is hooked up to it

pine bramble
#

is it possible to damage two pins so that analogRead always reads low?

still reef
#

Hello,
I just got a feather M0 and i noticed that it resets itself after a few seconds when connected to serial (usb) . It does not randomly reset when the serial monitor is not active. Apon opening serial port it will uasually reset after printing a couple lines (5 -20) seconds. Adding a very large delay (1000ms) between prints seems to help but anything shorter (10 - 200ms) seems to eventually lead to a reset.
Behavior was present on a mac and pc.

Any ideas whats going on?

summer bluff
#

Hey guys!!

I have a sensor that changes in less than a second. It stays on a "0" by default and by the press of a button it changes to a "1" very fast. My feed updates every 5 seconds or so and as such it is not able to sense this change with is very critical for my work.

So, please how can I reduce the time the feed takes to update, so that it can capture this change??

Thanks as I eagerly await a response

north stream
#

Increasing your feed speed is probably not the right answer for this use case, unless you have latency requirements as well. The usual approach is to capture the fact that the button was pressed, and send that (optionally with a timestamp) in the next feed update.

leaden dew
#

Heya, so for anyone who has a colour sensor chip (TCS34725), I want to make a project that will detect a colour for a few seconds and tell the user (via a i2c display and through a coloured LED) what colour it is.. I have no idea how to code it, only how it will be wired 😦

pine bramble
#

if i have this in my code my program runs different than without...

  if (digitalRead(fixture4Button) == LOW) {
    Serial.println("fix4but");
  }```
#

im so confused. i think i need to swap with a new arduino

leaden dew
#

a new bug?

pine bramble
#

a bug yes, but in my code i believe. solved that. now trying to figure out why pin 1 and 13 read LOW regardless of physical conditions

#
    Serial.println("button4press");
  } 

  else if (digitalRead(fixture5Button) == LOW) {
    Serial.println("button5press");
  } ```

`fixture4button` is on pin 0 `fixture5button` is on pin 1. when you run the program with the buttons hooked up pin 1's else if runs a couple times randomly with no input when you first reupload program and look in serial monitor. then when you press it for real it sends garbo to the serial monitor and makes my mosh terminal freak out
#

at this point i think swapping with a brand new arduino is in the cards for me. should be here weds

woven mica
#

Digital pins 0 and 1 on Arduino are for the serial communication (RX and TX), you cant use them when communicating over serial.

pine bramble
#

ok, that makes sense. pin 13 is still acting weird where it reads low regardless of physical conditions

woven mica
#

How is your button connected?

north stream
#

Are you using pinMode(INPUT_PULLUP)?

lapis notch
#

What is PWM????

woven mica
#

If your button is connected to GND, it would make sense that the D13 LED is pulling the pin down, so it is always LOW.

north stream
#

PWM is a way to output a waveform with a variable duty cycle (that is, it can go from always off to on a little of the time, to on half the time, to on most of the time, to always on).

pine bramble
#

button has one side on pin 13 one side to ground. yes i am using input_pullup

#

but even if i disconnect button from pin 13 and don't hit any other button on my project pin 13 reads low as input_pullup

woven mica
#

You should try to connect the button to 5V and D13, the LED pulls the pin down.

pine bramble
#

how would i read its state? keep it as input_pullup and detect if HIGH if its pressed?

woven mica
#

Yes, detect the HIGH state, but keep it only INPUT

pine bramble
#

ok. i'll try that. thanks

woven mica
#

You're welcome

pine bramble
#

i think i just need to start over, i have no idea what's happening and why at this point.

woven mica
#

The button on 5V doesnt work?

pine bramble
#

it is on constantly and turns off when you press it

woven mica
#

Did you change the LOW to HIGH in the if condition?

pine bramble
#

yes

woven mica
#
PushButton Button4 = fixture4Button;  // Create a new PushButton object on pin 2
PushButton Button5 = fixture5Button;

^This is not the correct way to initialize a class, you would do this:

PushButton Button4(fixture4Button);
PushButton Button5(fixture5Button);
pine bramble
#

i've gotten some simplified code to work but i've given up on pin 13. it is not working as it should

woven mica
#

Can you send your current code?

pine bramble
#

currently after uploading fixture4 and 5 are set to LOW when i specifically am saying go HIGH in my code

#

im so confused, this is insane

woven mica
#

Where do you set fixture4 and 5 to HIGH?

pine bramble
#

that and i was under the assumption that setting pinMode(pin, OUTPUT) then sets it as HIGH

woven mica
#

It doesn't, pin state after reset is undefined until you write to it

#

It is always good to set pins to desired state after initialization

pine bramble
#

ok, that was very educational. i think i need to do some reading

#
    fixture5state = !fixture5state;
    digitalWrite(fixture5, fixture5state);
  }``` this works fine as a button toggle. how would you recommend changing it to be momentary?
woven mica
#

The easiest way is to just write if(digitalRead(fixture5Button) == LOW)

pine bramble
#

thats how i was doing it in my main program i was working on earlier that was being weird

north stream
#

Or digitalWrite(OUT_PIN, digitalRead(IN_PIN));

pine bramble
#

tried if (Button4.isPressed()) { digitalWrite(fixture4, digitalRead(fixture4Button)); } amd it worked where you had to hit it like 3 times on 3 times off for it to finally toggle

chrome star
#

is'nt pin 13 wired to the onboard LED?

pine bramble
#

i need to move onto something else this is making me irrationally annoyed

#
  if (Button4.isPressed()) {
    digitalWrite(fixture4, LOW);
  }
  if (Button5.isPressed()) {
    digitalWrite(fixture5, LOW);
  } else {
    massDigitalWrite(fixtureArray, sizeof fixtureArray, HIGH);
  }
}```

does this weird thing where it just oscillates the relays so fast they wont even trigger...
chrome star
#

sounds like switch bounce to me... add a delay to let it settle, or average a coulpe readings?

pine bramble
#

already am doing that with a class called PushButton

#

i think my class only sends true for a split second which is the problem

#

idk though. everytime i think i'm understanding what i'm doing the rug gets pulled out from under me lol

woven mica
#

The library only returns true on falling edge of the button press, you should make it react to pin state instead of edge

chrome star
#

may not be quite correct as i'm not home; but it about what i normally use semantically at least.

pine bramble
chrome star
#

there needs to be something to reset PreviousState outside of the currentstate=HIGH if construct.

#

otherwise it'll never reset Prev. to LOW.

#

or vice-versa.

pine bramble
#

that class is way beyond my understanding, i did not write it.

chrome star
#

if you have no luck, i'll dig thru my code when i get home, and see what i can come up with... there's no need to track edges; just state.

#

or you could always hardware debounce with a capacitor. lol.

pine bramble
#

😛 i'm gonna step away for a few hours, enjoy the nice day. thank you all for helping me.

wet crystal
#

Do you know what to choose for any other mqtt service in espeasy?
Or do I have to use one the protocols they tell me that I have to use?

I just want to do simple things in my greenhouse and send that data to shifter.io

hidden oracle
#

Hi everyone,

may someone help me with the Arduino modulo operation?
In C, -2 mod 9 equals 7, in Arduino I get -2 ... But I need the 7 ^^

pine bramble
#

i have an array of int's i'd like to have a knob increase or decrease the size of the array evenly starting at the edges. any idea what i should google?

wide lark
#

if you need to use straight C you'll need to look into dynamic array resizing

#

but really, because you want to interact with both "ends" of the data structure, an array is not an ideal choice. a doubly-linked list would be a lot better/easier in straight C for your use case.

pine bramble
#

maybe i should look into an led library. im trying to address 8 pins and have them on off in sequence and back again and then split those 8 into halfs, thirds, random, etc

#

i'd imagine i'm reinventing the wheel here

wide lark
#

oh yeah, haha you definitely are. for that I use a 595 shift register, means I just send a byte with each bit set to which LEDs I want on. so much easier.

wide lark
#

@pine bramble an example of an 8-bit LED "meter" (yellow, red, 6 blues) using a 595 register. in its "demo" mode. very simple to setup and lets you address 8 individual outputs with only 3 GPIOs. hope it works for you!

#

(sorry for potato quality)

pine bramble
#

red button alone goes in sequence, red button with arcade red is supposed to cut array in half and do the same back n forth but buggy right now. red with blue arcade randomizes. yellow knob mapped to sleep duration

wide lark
#

nice! love that clicking, sounds so cool! and sweet buttons too, well done so far for sure 👍

#

yeah I'd definitely look into using a shift register, it'd make all that LED sequencing a lot easier

pine bramble
#

ok, i'll do that. i need to order more supplies so i can start making more complex circuits

wide lark
#

you can setup whole sequences as simple arrays of uint8s and run them at will

#

haha with that whole setup I'm kinda surprised you don't already have supplies on-hand, you seem well setup 😃

pine bramble
#

lots o hot glue

#

😂

wide lark
#

❤ hot glue!

pine bramble
#

my friend helped me on the enclosure

wide lark
#

is it aluminum?

pine bramble
#

nope steel

wide lark
#

it looks really nice

#

wow

pine bramble
#

its like 15lbs lol

wide lark
#

that's fantastic

#

🙀

pine bramble
#

designed it in illustrator then cut it on cnc plasma then bent 3 sides on brake press then bent last side by hand on table then welded bottom plate and front expanded steel grill on and painted

wide lark
#

👏 👏 👏

#

I'm a software guy, so stuff like that just blows my mind. impressive.

pine bramble
#

i can write bad javascript but this C++ stuff is a lil different

wide lark
#

all of my enclosures are made of foam board and hot glue 😆

#

haha yeah C++ is definitely its own beast. and I don't use "beast" lightly.

#

I have a long-term love/hate relationship with it.

pine bramble
#

like i figured there was just some random() function you could throw at stuff and be done with it

wide lark
#

oh no. if there's any language on the planet that is less accepting of "just throwing stuff at the wall to see what sticks" I don't know what it is!

pine bramble
#
              sizeof(randomFixtureArray) / sizeof(randomFixtureArray[0]);
          for (size_t i = 0; i < n - 1; i++) {
            size_t j = random(0, n - i);

            int t = randomFixtureArray[i];
            randomFixtureArray[i] = randomFixtureArray[j];
            randomFixtureArray[j] = t;```
#

thats what i got for my random atm

#

that and just reassigning a new array from an existing isn't just newarray[] = oldarray[];

wide lark
#

haha nope

pine bramble
wide lark
#

but I see what you're doing with your randomization, trying to swap stuff around in the array. not bad!

#

wishes he had access to a CNC machine...

pine bramble
#

we didn't realize how big it was before we cut it. probably should've looked. its decent lol

wide lark
#

HA! "measure twice, cut once" right? 😛

#

what's the eventual end goal for this project, a custom arcade cabinet?

pine bramble
#

need to order 6 more arcade buttons and cut the holes. arcade ones will be assigned to each one for individual control

wide lark
#

are you kidding me?! OMG that's going to be incredible

#

I ask only one thing in exchange for assistance: VIDEOS WHEN YOU GET IT WORKING!! 😄

pine bramble
#

i only have one built right now, they aren't too cheap lol

wide lark
#

LOL I imagine not!

#

but man the effect is going to be worth it

#

the sound they make too, wow. so cool.

pine bramble
#

yea one at 50 psi is loud enough to make some ppl mad

wide lark
#

HAHA! and eight, well... the airport might complain that they can't hear planes landing 😄 😄

pine bramble
#

hehe

#

we are building a dome to put them around as well. should have a busy summer

wide lark
#

incredible

pine bramble
#

also been working on having a flask app to control it remotely. got some controls working before having my pi talk to arduino over i2c

#

so i can lockout the panel remotely over wifi

wide lark
#

very nice, yeah I use flask as a front end for all my devices too, love how simple & easy it is. I'm very lazy when it comes to front end design so simply & easy is right up my alley.

pine bramble
#

yup for sure

nimble terrace
#

Omg that video was hot !

#

I drive a 30 ws2812 led strip with an esp32 ESP is powered by USB and the Led strip is powered with ESP VCC = 5v. Is there risks to burn the ESP if i use the strip at full brightness ? from datasheet it should have a max Amp of 1.8A for the 30 leds

wide lark
#

@nimble terrace as long as your USB PSU can supply 1.8A + whatever the ESP32 needs, I think you'll be fine. at worst you risk brownout, but I don't think you can burn it up as long as you're powering the 2812 strip directly from VIN (i.e. the PSUs output)

nimble terrace
#

ok thx

#

so the overflow of current does not goes into the ESP

fickle kelp
#

hey i cannnot use my new adafruit trinket

#

aways getting the same error

#

avrdude: error: usbtiny_receive: Broken pipe (expected 4, got -32)
avr_read(): error reading address 0x0000
read operation not supported for memory "flash"
avrdude: failed to read all of flash memory, rc=-2

avrdude: error: usbtiny_transmit: Broken pipe

#

how can i help that dude?

#

i connected to USB-C via adapter

vague kettle
#

i think i toasted my esp8266

#

at least it was cheap

#

havent given up yet, but i think its dead

fickle kelp
#

you smoke too much, thats bad role model to your clones

vague kettle
#

😛

stable forge
#

@fickle kelp what kind of trinket? is it trinket M0 or trinket classic? Trinket classic will not work with USB3/USB-C

#

gotta go, but check that

normal ginkgo
#

Is there a board (like trinket/feather) that has a real time unit? or dual cores? I'd like to farm off the load of watching a rotary encoder from the core running my neopixel strip.

earnest dove
#

anyone find support for the 2.2 inch tft ILI9225? Very limited sketches available for the Arduino.

north stream
#

I don't think the Pocket Beaglebone is in stock yet, but it has a pair of auxiliary real-time cores along with the main CPU.

normal ginkgo
#

I did think about the Beaglebone! I'm assuming the "pocket" part means it's smaller, which is unfortunately also part of what I'm looking for.

#

That board actually looks very capable. I wish my Linux beard was a little longer.

daring marsh
#

@earnest dove ili9225 is ancient but maybe ili9341 is compatible enough?

normal ginkgo
#

This guy talks about a way that the ESP32 can be used as a dual core board. AND there's a feather that fits the bill that I think I already have.

earnest dove
#

I will get a new board from Adafruit....They sent me the wrong chipset. No more, as I will buy from the best. lol