body:
I am having some problems with 2 MG90S servo motors with ESP8266 (nodemcu)(It is connect directly to digital pins D6 and D7). The basically turns the servo 90 degree and then sometimes it turns full 360 degrees many times. I know that in the code I should be using gate1.write(90) instead of gate.write(180) but 90 doesn't seem to work and 180 works perfectly to turn it to 90. BTW I also thought my servo could be continuous spinning 360 but according to the label and specs of the product it says 180 degrees. If somebody figures out what the problem is, please let me know...
Thanks a ton

    #include <Servo.h>
    Servo gate1;
    Servo gate2;
    void setup(void) {
      Serial.begin(115200);
      gate1.attach(12);
      gate2.attach(13);
      gate1.write(0);
      gate2.write(0);
      delay(1000)
      gate1.write(180);
      gate2.write(180);

title: MG90s servo motor acting weirdly with esp8266 nodemcu

Answers: 0


body:
I'm new here.

I've been trying to flash a bootloader to an atmega328p-au. I use an arduino nano as an ISP and have been double/triple checking my wiring because I'm getting the following error:

    avrdude: Device signature = 0xffffff (probably .avr8x_mega)
    avrdude: Yikes!  Invalid device signature.
             Double check connections and try again, or use -F to override
             this check.
this shows up with both the Arduino IDE bootloader and the MiniCore bootloader flasher module. Sometimes it will also be 0x00000000 or 0xffff0000

I have a sneaking suspicion it's because of my crystal oscillator circuit which is admittedly wrong as I have 100nf instead of 22pf capacitors , which you can see below:

[![enter image description here][2]][2]

  [1]: https://arduino.stackexchange.com/questions/84569/what-does-avrdude-device-signature-0x000000-mean-faulty-wiring-software-iss
  [2]: https://i.stack.imgur.com/pEFmy.png

That said, I encountered this thread: [Thread discussion on Atmega328p-AU (touches on oscillators)][1] where someone said:

> will occur if you're using ArduinoISP to flash a target Arduino and the target is not physically connected. So it really is an "all bets are off" message that doesn't pinpoint any particular cause. To troubleshoot, checking wiring if a good first step.

> Do not, on the other hand, concern yourself with the external clock signal. In contrast to some guides, the ATmega328P at least comes factory configured to use an internal RC oscillator, so even a correctly connected crystal or resonator on the XTAL pins will not show any activity until the first successful flash.

so now I'm wondering how big of an impact these caps actually have. Any help or feedback?

title: Trouble bootloading Atmega328p-au, are my capacitors messing with it?

Answers: 0


body: I have an audio book with some pictures and I would like to make a project with an LCD display and audio module, but I would like the video to be synced with the audio. meaning, I want the visual to go along the audio. I don't really know where to start, so please guide me if you know how :) Thanks.

title: Audio+Video sync project

Answers: 0


body:
I am making a board to power a 12V vacuum pump, with the use of a MOSFET to turn the pump on and off, (with the code below). I am using a motor to see if my design/circuit will work but I really can't tell if ot is working and I would really appreciate some help!
*/
```cpp
const int RELAY_PIN = 3; // the Arduino pin, which connects to the gate pin of MOSFET

void setup() {
   // initialize digital pin A5 as an output.
   pinMode(RELAY_PIN, OUTPUT);
}

void loop() {
   digitalWrite(RELAY_PIN, HIGH); // turn on pump 5 seconds
   delay(5000);
   digitalWrite(RELAY_PIN, LOW); // turn off pump 5 seconds
   delay(5000);
}
```
[![enter image description here][1]][1]

  [1]: https://i.stack.imgur.com/2p4uH.png

title: Help with circuit design for 12V vacuum pump and MOSFET

Answers: 1

body:
The motor gets direct voltage from the positive line. The negative from motor goes to the middle leg of the mosfet. The right leg(top in diagram) connects to main ground. The remaining left leg is your gate which gets the signal from your arduino, then through 10k resistor to ground.[![mosfet wiring diagram][1]][1]

  [1]: https://i.stack.imgur.com/vGZOO.jpg


body:
I saw the post asking how to save data to an array but no response for how to graph it.

I am using an Adafruit grand central M4.

The current attempt is below
```
//variables

uint16_t location = 0;
uint16_t SN = 1024;
double ecg[SN] = {0};

//setup

void loop() {
  double analogValueECG = analogRead(analogPin);
  ecg[location] = analogValueECG / 3.3d;

  ++location;
  location = location % SN;

  delay(10);
}
```

What I'm trying to do is plot this array in the serial plotter in IDE V2. I have tried using a for loop to print the array to the serial monitor as below, but that returns nan values for me.

```
for(uint16_t i = 0; i < SN; ++i) {
  Serial.print(ecg[i]);
  Serial.print("\t");
}
```

If there is a better way to visualize the array using arduino programs, I'm open to that as well.

title: Save to array and plot in Serial Monitor

Answers: 0


body:
I have ESP8266(WeMos D1 mini) and I want to connect BME280 and DHT22. My question is if I connect BME280 via I2C(GPIO4 and GPIO5) and DHT22 via 1-wire connection(GPIO14) will it work?
Will be there any issues?

Regards, Przemek

title: ESP8266 I2C and 1-wire at the same time

Answers: 0


body:
I'm using this 'ESP32-WROOM-32' but I can't find the correct board in the IDE. I see the esp32-wroom-DA (edit, i took it to the store where i bought it and it worked fine with theirs. they were on windows and im on mac. also they told me to use 'DOIT esp32 devkit' but im getting the same errors) but when I use that with this board it gives errors while compiling.

>Arduino: 1.8.18 (Mac OS X), Board: "ESP32-WROOM-DA Module, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None, Disabled"

>[2074] Error loading Python lib '/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/_MEIDMFx0d/libpython3.8.dylib': dlopen: dlopen(/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/_MEIDMFx0d/libpython3.8.dylib, 10): Library not loaded: @loader_path/libintl.8.dylib
  Referenced from: /var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/_MEIDMFx0d/libpython3.8.dylib
  Reason: no suitable image found. Did find:
 >/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/_MEIDMFx0d/libintl.8.dylib: cannot load 'libintl.8.dylib' (load command 0x80000034 is unknown)
 /private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/_MEIDMFx0d/libintl.8.dylib: cannot load 'libintl.8.dylib' (load command 0x80000034 is unknown)
exit status 255
/private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/arduino-builder returned 255
Error compiling for board ESP32-WROOM-DA Module.
>
>This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

And when I enabled show verbose output:

>Arduino: 1.8.18 (Mac OS X), Board: "ESP32-WROOM-DA Module, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None, Disabled"
>
>/private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/hardware -hardware /Users/drayeshahakim/Library/Arduino15/packages -tools /private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/tools-builder -tools /private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/drayeshahakim/Library/Arduino15/packages -built-in-libraries /private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/libraries -libraries /Users/drayeshahakim/Documents/Arduino/libraries -fqbn=esp32:esp32:esp32da:PartitionScheme=default,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,LoopCore=1,EventsCore=1,DebugLevel=none,EraseFlash=none -vid-pid=0000_0000 -ide-version=10818 -build-path /var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/arduino_build_386453 -warnings=none -build-cache /var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/arduino_cache_107457 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.esptool_py.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/esptool_py/4.5.1 -prefs=runtime.tools.esptool_py-4.5.1.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/esptool_py/4.5.1 -prefs=runtime.tools.xtensa-esp32s2-elf-gcc.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp32s2-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.xtensa-esp32s2-elf-gcc-esp-2021r2-patch5-8.4.0.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp32s2-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.mklittlefs.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/mklittlefs/3.0.0-gnu12-dc7f933 -prefs=runtime.tools.mklittlefs-3.0.0-gnu12-dc7f933.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/mklittlefs/3.0.0-gnu12-dc7f933 -prefs=runtime.tools.xtensa-esp32s3-elf-gcc.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.xtensa-esp32s3-elf-gcc-esp-2021r2-patch5-8.4.0.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.xtensa-esp32-elf-gcc.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.xtensa-esp32-elf-gcc-esp-2021r2-patch5-8.4.0.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.riscv32-esp-elf-gcc.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.riscv32-esp-elf-gcc-esp-2021r2-patch5-8.4.0.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.dfu-util.path=/Users/drayeshahakim/Library/Arduino15/packages/arduino/tools/dfu-util/0.11.0-arduino5 -prefs=runtime.tools.dfu-util-0.11.0-arduino5.path=/Users/drayeshahakim/Library/Arduino15/packages/arduino/tools/dfu-util/0.11.0-arduino5 -prefs=runtime.tools.riscv32-esp-elf-gdb.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/riscv32-esp-elf-gdb/11.2_20220823 -prefs=runtime.tools.riscv32-esp-elf-gdb-11.2_20220823.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/riscv32-esp-elf-gdb/11.2_20220823 -prefs=runtime.tools.openocd-esp32.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/openocd-esp32/v0.11.0-esp32-20221026 -prefs=runtime.tools.openocd-esp32-v0.11.0-esp32-20221026.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/openocd-esp32/v0.11.0-esp32-20221026 -prefs=runtime.tools.xtensa-esp-elf-gdb.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp-elf-gdb/11.2_20220823 -prefs=runtime.tools.xtensa-esp-elf-gdb-11.2_20220823.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp-elf-gdb/11.2_20220823 -prefs=runtime.tools.mkspiffs.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/mkspiffs/0.2.3 -prefs=runtime.tools.mkspiffs-0.2.3.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/mkspiffs/0.2.3 -verbose /private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/examples/01.Basics/Blink/Blink.ino
/private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/hardware -hardware /Users/drayeshahakim/Library/Arduino15/packages -tools /private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/tools-builder -tools /private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/drayeshahakim/Library/Arduino15/packages -built-in-libraries /private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/libraries -libraries /Users/drayeshahakim/Documents/Arduino/libraries -fqbn=esp32:esp32:esp32da:PartitionScheme=default,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,LoopCore=1,EventsCore=1,DebugLevel=none,EraseFlash=none -vid-pid=0000_0000 -ide-version=10818 -build-path /var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/arduino_build_386453 -warnings=none -build-cache /var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/arduino_cache_107457 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.esptool_py.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/esptool_py/4.5.1 -prefs=runtime.tools.esptool_py-4.5.1.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/esptool_py/4.5.1 -prefs=runtime.tools.xtensa-esp32s2-elf-gcc.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp32s2-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.xtensa-esp32s2-elf-gcc-esp-2021r2-patch5-8.4.0.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp32s2-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.mklittlefs.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/mklittlefs/3.0.0-gnu12-dc7f933 -prefs=runtime.tools.mklittlefs-3.0.0-gnu12-dc7f933.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/mklittlefs/3.0.0-gnu12-dc7f933 -prefs=runtime.tools.xtensa-esp32s3-elf-gcc.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.xtensa-esp32s3-elf-gcc-esp-2021r2-patch5-8.4.0.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.xtensa-esp32-elf-gcc.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.xtensa-esp32-elf-gcc-esp-2021r2-patch5-8.4.0.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.riscv32-esp-elf-gcc.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.riscv32-esp-elf-gcc-esp-2021r2-patch5-8.4.0.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/esp-2021r2-patch5-8.4.0 -prefs=runtime.tools.dfu-util.path=/Users/drayeshahakim/Library/Arduino15/packages/arduino/tools/dfu-util/0.11.0-arduino5 -prefs=runtime.tools.dfu-util-0.11.0-arduino5.path=/Users/drayeshahakim/Library/Arduino15/packages/arduino/tools/dfu-util/0.11.0-arduino5 -prefs=runtime.tools.riscv32-esp-elf-gdb.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/riscv32-esp-elf-gdb/11.2_20220823 -prefs=runtime.tools.riscv32-esp-elf-gdb-11.2_20220823.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/riscv32-esp-elf-gdb/11.2_20220823 -prefs=runtime.tools.openocd-esp32.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/openocd-esp32/v0.11.0-esp32-20221026 -prefs=runtime.tools.openocd-esp32-v0.11.0-esp32-20221026.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/openocd-esp32/v0.11.0-esp32-20221026 -prefs=runtime.tools.xtensa-esp-elf-gdb.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp-elf-gdb/11.2_20220823 -prefs=runtime.tools.xtensa-esp-elf-gdb-11.2_20220823.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/xtensa-esp-elf-gdb/11.2_20220823 -prefs=runtime.tools.mkspiffs.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/mkspiffs/0.2.3 -prefs=runtime.tools.mkspiffs-0.2.3.path=/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/mkspiffs/0.2.3 -verbose /private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/examples/01.Basics/Blink/Blink.ino
Using board 'esp32da' from platform in folder: /Users/drayeshahakim/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11
Using core 'esp32' from platform in folder: /Users/drayeshahakim/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11
bash -c "[ ! -f \"/private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/examples/01.Basics/Blink\"/partitions.csv ] || cp -f \"/private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/examples/01.Basics/Blink\"/partitions.csv \"/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/arduino_build_386453\"/partitions.csv"
bash -c "[ -f \"/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/arduino_build_386453\"/partitions.csv ] || [ ! -f \"/Users/drayeshahakim/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/variants/esp32da\"/partitions.csv ] || cp \"/Users/drayeshahakim/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/variants/esp32da\"/partitions.csv \"/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/arduino_build_386453\"/partitions.csv"
bash -c "[ -f \"/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/arduino_build_386453\"/partitions.csv ] || cp \"/Users/drayeshahakim/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11\"/tools/partitions/default.csv \"/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/arduino_build_386453\"/partitions.csv"
bash -c "[ -f \"/private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/examples/01.Basics/Blink\"/bootloader.bin ] && cp -f \"/private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/examples/01.Basics/Blink\"/bootloader.bin \"/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/arduino_build_386453\"/Blink.ino.bootloader.bin || ( [ -f \"/Users/drayeshahakim/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/variants/esp32da\"/bootloader.bin ] && cp \"/Users/drayeshahakim/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/variants/esp32da\"/bootloader.bin \"/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/arduino_build_386453\"/Blink.ino.bootloader.bin || \"/Users/drayeshahakim/Library/Arduino15/packages/esp32/tools/esptool_py/4.5.1\"/esptool --chip esp32 elf2image --flash_mode dio --flash_freq 80m --flash_size 4MB -o \"/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/arduino_build_386453\"/Blink.ino.bootloader.bin \"/Users/drayeshahakim/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/tools/sdk/esp32\"/bin/bootloader_qio_80m.elf )"
[2164] Error loading Python lib '/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/_MEIXurqHc/libpython3.8.dylib': dlopen: dlopen(/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/_MEIXurqHc/libpython3.8.dylib, 10): Library not loaded: @loader_path/libintl.8.dylib
  Referenced from: /var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/_MEIXurqHc/libpython3.8.dylib
  Reason: no suitable image found.  Did find:
 /var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/_MEIXurqHc/libintl.8.dylib: cannot load 'libintl.8.dylib' (load command 0x80000034 is unknown)
 /private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/_MEIXurqHc/libintl.8.dylib: cannot load 'libintl.8.dylib' (load command 0x80000034 is unknown)
exit status 255
/private/var/folders/sz/zm5vw9m92t9_07j6scr85q400000gn/T/AppTranslocation/F61C5E6A-0B57-4967-97C2-77C38540CF2B/d/Arduino.app/Contents/Java/arduino-builder returned 255
Error compiling for board ESP32-WROOM-DA Module.
```
also im using macos 10.13.6, the store i got it from (and it worked fine for them) was on windows

title: How can I connect my ESP32-WROOM-32 to Arduino IDE?

Answers: 0


body:
I want to code a program that commands the servo motor **only rotate 90 Deg** but it keeps turning and not rotating 90 deg, this is my code

```#include <Servo.h>
#define Servo_PWM 6
Servo MG995_Servo;

void setup() {
  Serial.begin(9600);
  MG995_Servo.attach(Servo_PWM);

}

void loop() {
  MG995_Servo.write(0);
  delay(3000);
  MG995_Servo.write(90);
  delay(3000);
} ```

title: TowerPro MG995 cannot just rotate 90 Deg

Answers: 0


body:
Windows 7 (64Bit) Parallels VM on Macbook Pro running BigSur. Arduino version 1.18.19, Digispark ATtiny85 Micro USB.

Loaded Boards Manager http://digistump.com/package_digistump_index.json and updated all.
Installed Windows Driver DPinst64 from digistump.
Device Manager shows:

>libusb-win32 USB Devices<br>
>   Digispark Bootloader

This a first-time use of Digispark.

I have written a couple of successful programs for the ESP32 devkit v1.
```cpp
Test Program

    void setup() {
      // initialize the digital pin as an output.
      pinMode(0, OUTPUT); //LED on Model B
      pinMode(1, OUTPUT); //LED on Model A
    }

    // the loop routine runs over and over again forever:
    void loop() {
      digitalWrite(0, HIGH); // turn the LED on (HIGH is the voltage level)
      digitalWrite(1, HIGH);
      delay(5000); // wait for a second
      digitalWrite(0, LOW); // turn the LED off by making the voltage LOW
      digitalWrite(1, LOW);
      delay(5000); // wait for a second
    }
```
Compiles OK. Upload immediately goes to the following error: (with the Digispark not plugged in).

>Running Digispark Uploader...\
Plug in device now... (will timeout in 60 seconds)\
Assertion failed: res >= 4, file library/micronucleus_lib.c, line 100

I can find no relevant information on the error, I need help.

title: First Uses of Digispark can't get past upload error

Answers: 1

body:
The device is only in bootload mode for a brief moment after power-up, therefore you have to unplug the device before hitting upload, and *only* connect it once it tells you to. This way the programmer can hit the bootloader in time to halt normal bootup, before execution is handed off to your code.

Literally stumbled over the same issue today, dunno why it won't just tell you this in the console right away.


body:
I'm a beginner into Arduino so I have a little problem where I'm trying to do a countdown on LCD using while loop but I'm also trying to get a key input inside that same while loop. Problem is that its hard to get a input in that while because there are delay because of timer. Tried to look around the internet for solution but didn't find one. If anybody got a good solution I would be great full if you post it :) Thanks again!

Here is my code:
```
while (gameInProgress) {

    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Until boom! ");
    lcd.print(timer);
    lcd.setCursor(0, 1);
    lcd.print(passwordInputed);

    char key = keypad.getKey();
    if (key && gameInProgress) {
      passwordInputed += key;
    }

    analogWrite(buzzerPin, 145);
    delay(200);
    analogWrite(buzzerPin, 0);
    delay(800);
    timer--;
    if (timer == 0){
      gameInProgress = false;
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("Boom happend!");
      lcd.setCursor(0, 1);
      lcd.print("You lost :(");
    }
  }
```

title: Unable to get keypad key in while loop

Answers: 1

body:
In general, when a program needs to perform two or more functions (for example, counting off seconds and reacting to a button press that could happen at any moment) a [state machine][1] programming pattern will provide an optimal solution.

Essentially, remove all calls to delay(). Instead, record the value returned from millis() outside the loop. If tracking a, say, 1 second (1000ms) interval, add 1000 to the recorded value. Each time through the loop, check if mills() is greater then the recorded value.  When it is, change the state, add 1000 to the recorded value again and do what ever is needed when the state indicating 1 second has elapsed has changed.  Now clear the state and wait for the cycle to repeat.

As this loop with out calls to delay() is being executed as fast as possible, a scan for a button press can be added and the necessary reaction to that button press can be very responsive.

Add states as needed for more complex behavior. Remember, in most state machines, outputs normally happen upon state changes. And there are no delays within the loop.  Tests to trigger state changes are run as fast as possible each time through the loop.

  [1]: https://en.wikipedia.org/wiki/Finite-state_machine


body: Is it possible to use a Win32 script to read the value of say, A0, and store it in a local variable? I need to use the value to control another part of the script.

title: How to read potentiometer using Win32

Answers: 0


body:
I purchased some STM32F103C8T6 from AliExpress, which I soldered to my custom PCB via a reflow oven. But the problem is, my program uploaded, but it did not run.

To confirm that it's not the PCBs, I removed some STM32F103C8T6 from ready-made boards, which I'm no longer using, and mounted them on my custom PCBs. The code uploaded and ran successfully. I tried different programs and they worked well.

But all the chips from AliExpress won't run after uploading different code. STM32CubeProgrammer detected the chips; I did a full chip erase, programmed the ICs again, but the code still did not execute.

I'm programming with Arduino IDE via USB-serial converter (A9, A10). I have contacted the seller from AliExpress, but he said the chips are original and that I should look for the fault elsewhere.

Someone mentioned a bootloader problem - that the chip may not come preloaded with a bootloader, which is required for program execution.

Pin 44 - Boot0 was pulled high during programming then pulled to ground via a resistor after programming.

Please kindly advise what I'm doing wrong or let me know if I bought fake STM32F103C8T6.

Thanks in advance.

title: How to make the STM32F103C8T6 compatible with Arduino IDE?

Answers: 0


body:
I was working on a project to use the ESP32CAM board to detect faces and open some sort of lock. The program can detect the face using the yellow box that shows up as you can see from the following image:
[![enter image description here][1]][1]

  [1]: https://i.stack.imgur.com/exY9e.jpg

But after clicking "Enroll Face", nothing changes. I'm currently using the default CameraWebServer application located in the ESP32CAM board examples. Any advice to solve these issues would be greatly appreciated

title: Using ESP32CAM board but no face is enrolled

Answers: 1

body:
The short version is you need an ESP32-S3 (which the ESP32CAM isn't) if you want practical face recognition from this example. But you *may* be able to make face recognition work on the ESP32CAM with this example *very slowly* if you really want to try it.

---

A comment the example code [explains](https://github.com/espressif/arduino-esp32/blob/master/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino#L9-L11):

> You must select partition scheme from the board menu that has at least 3MB APP space.
> Face **Recognition is DISABLED for ESP32** and ESP32-S2, because it takes up from 15
> seconds to process single frame. Face *Detection* is ENABLED if PSRAM is enabled as well

My understanding is "detection" refers to just what you're seeing in the image you've included, that it can find faces (**any** face) and draw a box around it. This makes sense because [the board has PSRAM](https://github.com/espressif/arduino-esp32/blob/2.0.14/boards.txt#L16954).

"Recognition" is detection of the **specific** face you "enroll", which "is DISABLED for ESP32". And the ESP32CAM [uses an ESP32](https://github.com/espressif/arduino-esp32/blob/2.0.14/boards.txt#L16947-L16950) (importantly not more powerful ESP32-**S3**)

You can see this again in the form of code rather than a comment [in the web server code](https://github.com/espressif/arduino-esp32/blob/2.0.14/boards.txt#L16947-L16950).

The web page served is not configured to show anything different when those features are disabled. It it just passes events back to the web server code. However, if you're looking at the serial output you should see messages [saying](https://github.com/espressif/arduino-esp32/blob/2.0.14/libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp#L923C1-L923C48) "Unknown command: face_enroll" and "Unknown command: face_recognize" if you have the Core Debug Level setting at Info level or higher.

---

They say it takes 15 seconds on an plain ESP32, which apparently means it is possible if a bit useless. So, if you really want to try it you may be able to modify [this line](https://github.com/espressif/arduino-esp32/blob/2.0.14/libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp#L35C19-L35C19) in app_httpd.cpp to read:

```c++
#define CONFIG_ESP_FACE_RECOGNITION_ENABLED 1
```

<s>I may try it later if I find my ESP32CAM. But the expectation is that it will "work" but have horrible performance.</s> Well, I found my ESP32CAM and edited that line and yes, it barely functions, but you can see that does technically work, at least for a little while. I may be crashing it during the enroll process or it might just be picking up what it thinks are extra faces and it's so bogged down that it stops responding, which may have motivated why they just disabled it outright. Either way, yeah, it behaves more or less as explained by the comment.


body: How To Extract Code of S-Function builder from mpu6050_light library §

title: How To Extract Code of simulink S-Function builder from mpu6050_light library

Answers: 0


body: I have a project (still planning) with three I2C sensors: GPS, 3-axis gyro+accelerometer, and OLED. Do I connect SDA/SCL in series, or do I connect them in parallel?

title: Do I connect multiple I2C units to the microcontroler in series or parallel?

Answers: 2

body: Connect the three I2C devices in parallel.

body:
Use the [Wikipedia page on the protocol][1] as an introduction to your learning curve on I2C. I may cite:

> At the physical layer, both SCL and SDA lines are [a ...] bus design, [...]

This means that all devices connect in parallel (image from the same page, public domain):

[![enter image description here][2]][2]

> Rp are pull-up resistors, Rs are **optional** series resistors. (Emphasis by me)

  [1]: https://en.wikipedia.org/wiki/I²C
  [2]: https://i.stack.imgur.com/esXHK.png


body:
I am new at programing with Arduino have done some basic stuffs with it. Today, when I tried to open Arduino IDE again to do a new project I found out that it wouldn't let me write any code on it. It will stay in blank and no code can be loaded or written on it. I can't open past codes either.
[![enter image description here][1]][1]

[![enter image description here][2]][2]

When I go to Files > Preferences, then I get this weird window where no options are available.

  [1]: https://i.stack.imgur.com/DfaU7.png

  [2]: https://i.stack.imgur.com/kycNO.png

I already tried uninstalling and reinstalling it but didn't work. But for the case of "Legacy IDE (1.8.X) - Arduino IDE 1.8.19 " it works just okay. Does anyone know how to solve this problem? Any help would be really appreciated ;(

title: Arduino IDE 2.2.1 stuck in blank and does not let me write or load any code, no board is detected either

Answers: 0


body:
I'm not a programmer, I am also not a hardware engineer... so explain like I'm 5 if you can.

Background- I found an old xbox 360 at goodwill. It has parental controls.
I thought it would be a fun project to see If I could use a teensy 4.0 to brute force the code and unlock it.

EDIT: Code
```
void setup() {
  Serial.begin(9600);
  delay(3000);
}

void loop() {

  static int number = 0; // The number to test between 0 y 9999
  static int module = 0; // Stores the module of the number divided by a power of ten
  static int power = 1000; // The power of ten in which the number is divided.
  int counter;

  if(number < 10000) // if the number is below 10000 and a key can be pressed
  {
    counter = 0;
    if(power == 0) // Press enter to close the invalid key screen
    {
      Keyboard.println(); //print a carriage return
      power = 1000;
      number++; // Next number in the sequence
      module = number;
      delay(1500);
    }
    else
    {
      switch(module / power) // The result of the division is the number to simulate a press
      {
        case 0:
          Keyboard.print("0");
          break;
        case 1:
          Keyboard.print("1");
          break;
        case 2:
          Keyboard.print("2");
          break;
        case 3:
          Keyboard.print("3");
          break;
        case 4:
          Keyboard.print("4");
          break;
        case 5:
          Keyboard.print("5");
          break;
        case 6:
          Keyboard.print("6");
          break;
        case 7:
          Keyboard.print("7");
          break;
        case 8:
          Keyboard.print("8");
          break;
        case 9:
          Keyboard.print("9");
          break;
      }

      module %= power; // Get the module for the next operation
      power /= 10; // Obtain the previous power of ten
      if(power == 0) // If we have sended all digits
      {
        delay(900); // Wait .9 seconds for retry message to pop-up on incorrect code input - Increase this to 1000 or even 1500 if needed.
      }
      else
      {
        delay(rand() % 20 + 100); // Next key press in 20 to 100ms. Increase to 500 + 1500 to delay between 0.5 & 1.5 seconds if necessary.
      }
    }
  }
}
```
It also seems the code was originally written for a teensy 2.0++... if so what would I need to modify (If anything) for a 4.0?
It compiles and uploads fine it seems.

What I've done- I got a teensy 4.0, found this code online
[here][1]

I got Arduino IDE set up and running... loaded the code on the teensy and it runs just fine on the PC typing 0000, 0001 and so on. When I plug the Teensy into the xbox 360 it isn't recognized and nothing happens.  I added some LED flashing so I could tell if it was running and it was.
I have set the usb type to "Keyboard" and "Keyboard+Mouse+Joystick" (and the others to test) because xbox 360 does in fact recognize USB keyboards. I can type with the logitec USB keyboard I have.

So what am I missing here?

  [1]: https://www.youtube.com/redirect?event=video_description&redir_token=QUFFLUhqbDNFSGZyVFpkZFNoUF9tSV9FNVNxbTFXN3JQd3xBQ3Jtc0ttbWwzX2o1NjBVYWx0aVlrRzdoUHRfRnhSS3VUM0YtQUU4eklrN3lyd21IUDNhSnd3MktQdXN4b1hvenVsM09wdl95bGJuUUxpQnFkN0x0SDZMZzEwMXBodEpkeHRDbDdrUXZhN0lvUWFTNGhQazVQZw&q=https://agent24.yolasite.com/resources/Files/XBOX-360_parentalcode_bypass/XBOX360_ParentalCode_Reset.zip&v=LsjCcXpgRIM

title: Teensy 4.0 is not recognized by xbox 360 as a usb keyboard

Answers: 0


body:
[![enter image description here][1]][1]

  [1]: https://i.stack.imgur.com/y4g83.png
There is no color highlighting when entering a command.

title: Здравствуйте почему у меня не выделяется зелёным команда OUTPUT?

Answers: 0


body:
I'm trying to build a serial over radio transmitter module using two Feather M0 boards with RFM69HCW chips on board. As a test I'm trying to run a ```slip``` IP over serial session. This seems to work consistantly for UDP sessions (in my case ICMP ping requests) but fails for TCP sessions (in my case a simple HTTP request).

Here is the code:

```C++
#include <RFM69.h>
#include <RFM69_ATC.h>
#include <SPI.h>
#include <string>
// a simple off the shelf CRC8 implementation
#include <crc.h>

// defined for one of the two boards
// #define B

#ifdef B
#define NODEID 1
#define RECEIVER 2
#endif
#ifndef B
#define NODEID 2
#define RECEIVER 1
#endif

#define MAX_BYTES 56

#define NETWORKID 100
#define FREQUENCY RF69_433MHZ
#define IS_RFM69HW_HCW

RFM69_ATC radio(8, 3, true);

char buf[512];

void setup()
{
  // initialize random using receiver address
  // this guarantees that both nodes have different initial random values
  randomSeed(RECEIVER);

  Serial.begin(115200);

  radio.initialize(FREQUENCY, NODEID, NETWORKID);
  radio.setPowerLevel(0);
  radio.setFrequency(446000000);
}

int8_t receiver_last_id = -1;

bool read_packet(bool override = false)
{
  if (radio.receiveDone() || override)
  {
    int cnt = radio.DATALEN - 2;
    int crc = radio.DATA[0];
    int8_t packet_id = radio.DATA[1];

    memcpy(buf, radio.DATA + 2, cnt);

    uint8_t crc_data = crc8(0, (uint8_t*)buf, cnt);

    if (radio.ACKRequested())
    {
      if (crc == crc_data)
      {
        radio.sendACK();

        // sometimes duplicates seem to occure
        // in case this happens just ignore the packet
        if (packet_id != receiver_last_id)
        {
          Serial.write(buf, cnt);
          receiver_last_id = packet_id;
          return true;
        }
        return false;
      }
      else
      {
        radio.ACK_REQUESTED = 0;
        return false;
      }
    }

    return false;
  }
  return false;
}

int8_t sender_packet_id = 0;

bool send_packet()
{
  int serial_cnt = Serial.available();

  if (serial_cnt > 0 && radio.canSend())
  {
    // packet structure:
    // 1. byte: CRC8 of DATA
    // 2. byte: ID of packet (to prevent duplicates)
    // variable length: DATA

    int payload_size = min(MAX_BYTES, serial_cnt);
    int total_size = payload_size + 2;

    Serial.readBytes((char *)buf + 2, payload_size);
    buf[0] = crc8(0, (uint8_t*)(buf + 2), payload_size);
    buf[1] = sender_packet_id++;

    while (!radio.sendWithRetry(RECEIVER, buf, total_size, 1, 5U))
    {
      // radio.receiveDone() switches the
      // radio into receive mode
      if (radio.receiveDone())
      {
        // if receive is done instantly
        // process the packet and move on
        read_packet(true);
        continue;
      }

      // wait random time in case
      // a collision happened
      delay(random(5, 30));

      read_packet();

      // wait for radio to be ready to send
      while (!radio.canSend()) ;
    }

    return true;
  }

  return false;
}

void loop()
{
  read_packet();

  send_packet();
}
```

I also have a network capture of both sides.

Here is the capture for the Client: https://ufile.io/v945jl8i

Here is the capture for the Server: https://ufile.io/yn36rjw4

I've figured out that it happens somewhere in the ```while (!radio.sendWithRetry(RECEIVER, buf, total_size, 1, 5U))``` loop but I can't figure out what exactly goes wrong and how I can fix it.

Any help would be greatly appreciated!

Edit: I'm running a simple python HTTP server (```python 3 -m http.server 8080```). And as client i'm using curl (```curl <server address>:8080```)

Here are the Commands I use for starting slip:
```bash
modprobe slip
slattach -vL -s 115200 -p slip /dev/ttyACM0
ifconfig sl0 192.168.2.1 pointtopoint 192.168.2.2 up
```

I switched the two IP addresses for the other side.

Also interestingly it sometimes seems to randomly work for one or two requests, so i'm guessing some kind of race condition.

I also made sure that i'm connecting to the correct serial ports.

PS: i'm kind of new to C++ so any recommendations on best practices are also appreciated

title: Feather M0 RFM69 serial over radio IP over serial works for UDP packets but fails for TCP sessions

Answers: 0


body:
I want to power 4 microcontrollers (Uno, Mega, ESP8266 and ESP32) but I do not know the recommended specification required for them. What I read tells me that I should plug in XX volt (DC power source) into Vin and GND. I'm confused, they do not mention what watt or what ampere is permitted for 5 of them.

Mini solar cells available in my country are 12 V, +- 1.5 watt and the other is 5V, 1 watt. Without a solar charge controller, I plan to connect them into microcontrolers directly. Can you tell me how many solar cells are required for each of these microcontrollers?

Example: ESP8266 needs 4 solar cells 5V, 1 watt. Assemble all of them in parallel to increase electric current.

title: How to power a microcontroller with solar power?

Answers: 0


body:
I've disassembled a drone and found a gps module, I want to use it. I haven't found any information about the architecture and the `Serial.begin` value I have to use. Could I break it if I try a different value of `Serial.begin` as 4800,9600 and different type of architecture like nmea with TinyGPS?

the module: https://www.aliexpress.us/item/3256805691773977.html

I've tried this sketch and `ss.available()` is constantly false, why no char is available?

    #include <SoftwareSerial.h>

    #include <TinyGPS.h>

    /* This sample code demonstrates the normal use of a TinyGPS object.
       It requires the use of SoftwareSerial, and assumes that you have a
       4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
    */

    TinyGPS gps;
    SoftwareSerial ss(4, 3);

    void setup()
    {
      Serial.begin(115200);
      ss.begin(4800);

      Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version());
      Serial.println("by Mikal Hart");
      Serial.println();
    }

    void loop()
    {
      bool newData = false;
      unsigned long chars;
      unsigned short sentences, failed;

      // For one second we parse GPS data and report some key values
      for (unsigned long start = millis(); millis() - start < 1000;)
      {
        while (ss.available())
        {
          char c = ss.read();
          // Serial.write(c); // uncomment this line if you want to see the GPS data flowing
          if (gps.encode(c)) // Did a new valid sentence come in?
            newData = true;
        }
      }

      if (newData)
      {
        float flat, flon;
        unsigned long age;
        gps.f_get_position(&flat, &flon, &age);
        Serial.print("LAT=");
        Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
        Serial.print(" LON=");
        Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
        Serial.print(" SAT=");
        Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
        Serial.print(" PREC=");
        Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
      }

      gps.stats(&chars, &sentences, &failed);
      Serial.print(" CHARS=");
      Serial.print(chars);
      Serial.print(" SENTENCES=");
      Serial.print(sentences);
      Serial.print(" CSUM ERR=");
      Serial.println(failed);
      if (chars == 0)
        Serial.println("** No characters received from GPS: check wiring **");
    }

title: gps module Serial.begin value

Answers: 0


body:
1. Can anybody help me **with examples** of code with matrix? or:

How is the approach to optimize code relative to my example with using "switch case" to "arrays"? Without changing its functionality, but reducing the amount of code by approximately 10 times.

  2. How will all this affect the performance of the code for the MIDI protocol?

#### code description: ####
*This is for **Arduino to MIDI** the CC#2SysEx translator working code, using for a synthesizer witch understands SysEx commands only. The code convertating incoming MIDI CC# into SysEx according to the setted mapping table,*

*but before running we expose changes the CCbyteValue range (0-127) to scailed into the value range of target parameter, that the device receiving the final SysEx messages is ready to read. For exsample:*

```
//MIDIinCC#hex; targetParam#; Discribtion;       Val.range;   scaling
    case 0x04:   // param 4   VCF Mode/Slope          (2)       >>6
    case 0x43:   // param 67  OSC MG Select           (4)       >>5
    case 0x4A:   // param 74  Unison Detune           (8)       >>4
    case 0x1C:   // param 28  Vel. VCF Cutoff        (16)       >>3
    case 0x44:   // param 68  OSC MG Frequency       (32)       >>2
    case 0x03:   // param 3   Noise Level.           (64)       >>1
    case 0x06:   // param 6   VCF Cutoff            (128)       =
...
    case 0x3F:   // param 63  OSC1 Octave             (3)      *1/43
    case 0x3E:   // param 62  Bit DA Resolution       (5)      *1/26
    case 0x42:   // param 66  Osc 2 Interval   (12)     *24/256
    case 0x28:   // param 40  JStck PBend Range      (13)     *26/256
    case 0x00:   // param 0   OSC1 Level            (101)    *203/256
...
    case 0x2e:   // param 46  DDL-1 Time      (501)    *252/64
    case 0x34:   // param 52  DDL-2 Time      (501)
...
```
documentation for MIDI inplementation charts:  https://dn790004.ca.archive.org/0/items/sm_DSS-1ServiceManual/DSS-1ServiceManual.pdf

```c++
#include <MIDI.h>

MIDI_CREATE_DEFAULT_INSTANCE();

const int ledPinOut = 13;
const int dssCh = 0;

//only for parameters with range upto 500 [9 byte length of SysEx]
void sendDSS1Param_9(byte channel, byte paramNumber, byte paramValue7Bit) {
  const int sysexLen = 9;
  static byte sysexData[sysexLen] = {0xf0, 0x42, 0x30, 0x0b, 0x41, 0x00, 0x00, 0x00, 0xf7};
  paramValue7Bit &= 0x7f;
  int paramValueScaled;
  switch (paramNumber) {case 0x2e: case 0x34: paramValueScaled = paramValue7Bit*252/64;}
  sysexData[2] = 0x30 | ((channel - 1) & 0x0f);
  sysexData[5] = paramNumber;
  sysexData[6] = paramValueScaled & 0x7f;       //LSB
  sysexData[7] = (paramValueScaled >> 7) & 0x03;//MSB
  MIDI.sendSysEx(sysexLen, sysexData, true);
}

void sendDSS1Param_8(byte channel, byte paramNumber, byte paramValue7Bit) {
  const int sysexLen = 8;
  static byte sysexData[sysexLen] = {0xf0, 0x42, 0x30, 0x0b, 0x41, 0x00, 0x00, 0xf7};
  paramValue7Bit &= 0x7f;
  byte paramValueScaled = 0;
//here we rescale to fit to appropriate bit width for each param
  switch (paramNumber) {
  case 0x04: // param 4     VCF Mode/Slope      (2)
  case 0x05: // param 5     VCF EG Polarity     (2)
  case 0x26: // param 38    ATch VCF Mode       (2)
  case 0x29: // param 41    JStck VCF Mode      (2)
  case 0x33: // param 51    DDL2 Input Select   (2)
  case 0x39: // param 57    DDL2 Mod Invert     (2)
  case 0x3D: // param 61    Sync Mode           (2)
  case 0x48: // param 72    A.Bend Polarity Mode(2)
  paramValueScaled = paramValue7Bit >> 6; break;
  case 0x43: // param 67    OSC MG Select       (4)
  case 0x47: // param 71    A.Bend Select       (4)
  case 0x4D: // param 77    Unison Voices       (4)
  paramValueScaled = paramValue7Bit >> 5; break;
  case 0x4A: // param 74    Unison Detune       (8)
  paramValueScaled = paramValue7Bit >> 4; break;
  case 0x1C: // param 28    Vel. VCF Cutoff     (16)
  case 0x24: // param 36    ATch OSC MG Intens  (16)
  case 0x25: // param 37    ATch VCF Level      (16)
  case 0x27: // param 39    ATch VCA Level      (16)
  case 0x2F: // param 47    DDL1 Feedback       (16)
  case 0x30: // param 48    DDL1 Effect Level   (16)
  case 0x35: // param 53    DDL2 Feedback       (16)
  case 0x36: // param 54    DDL2 Effect Level   (16)
  case 0x3A: // param 58    OSC1 Multisound     (16)
  case 0x3B: // param 59    OSC2 Multisound     (16)
  case 0x46: // param 70    OSC MG Delay        (16)
  paramValueScaled = paramValue7Bit >> 3; break;
  case 0x44: // param 68    OSC MG Frequency    (32)
  case 0x49: // param 73    A.Bend/Porta.time   (32)
  case 0x4B: // param 75    Vel.OSC X-Switch    (32)
  paramValueScaled = paramValue7Bit >> 2; break;
  case 0x03: // param 3     Noise Level         (64)
  case 0x07: // param 7     VCF EG Intensity    (64)
  case 0x08: // param 8     VCF Resonance       (64)
  case 0x09: // param 9     VCF Kbd Track       (64)
  case 0x0A: // param 10    VCF MG Frequency    (64)
  case 0x0B: // param 11    VCF MG Delay        (64)
  case 0x0C: // param 12    VCF MG Intensity    (64)
  case 0x0D: // param 13    VCF EG Attack       (64)
  case 0x0E: // param 14    VCF EG Decay        (64)
  case 0x0F: // param 15    VCF EG Breakpoint   (64)
  case 0x10: // param 16    VCF EG Slope        (64)
  case 0x11: // param 17    VCF EG Sustain      (64)
  case 0x12: // param 18    VCF EG Release      (64)
  case 0x14: // param 20    VCA Level           (64)
  case 0x15: // param 21    VCA EG Attack       (64)
  case 0x16: // param 22    VCA EG Decay        (64)
  case 0x17: // param 23    VCA EG Breakpoint   (64)
  case 0x18: // param 24    VCA EG Slope        (64)
  case 0x19: // param 25    VCA EG Sustain      (64)
  case 0x1A: // param 26    VCA EG Release      (64)
  case 0x1B: // param 27    Vel.A.Bend Intens   (64)
  case 0x1D: // param 29    Vel.VCF EG Attack   (64)
  case 0x1E: // param 30    Vel.VCF EG Decay    (64)
  case 0x1F: // param 31    Vel.VCF EG Slope    (64)
  case 0x20: // param 32    VCA EG Intensity    (64)
  case 0x21: // param 33    Vel.VCA EG Attack   (64)
  case 0x22: // param 34    Vel.VCA EG Decay    (64)
  case 0x23: // param 35    Vel.VCA EG Slope    (64)
  case 0x2C: // param 44    DDL MG-A Freq.      (64)
  case 0x2D: // param 45    DDL MG-B Freq.      (64)
  case 0x31: // param 49    DDL1 MG-A Intens    (64)
  case 0x32: // param 50    DDL1 MG-B Intens    (64)
  case 0x37: // param 55    DDL2 MG-A Intens    (64)
  case 0x38: // param 56    DDL2 MG-B Intens    (64)
  case 0x41: // param 65    OSC2 Detune         (64)
  case 0x45: // param 69    OSC MG Intensity    (64)
  paramValueScaled = paramValue7Bit >> 1; break;
  case 0x02: // param 2     A.B.Intesity/Prt.mix(128)
  case 0x06: // param 6     VCF Cutoff          (128)
  case 0x13: // param 19    VCA Kbd Decay       (128)
  paramValueScaled = paramValue7Bit; break;
  case 0x3F: // param 63    OSC1 Octave         (3)
  case 0x40: // param 64    OSC2 Octave         (3)
  case 0x4C: // param 76    Key Assign mode     (3)
  paramValueScaled = paramValue7Bit/43; break;
  case 0x3E: // param 62    Bit DA Resolution   (5)
  paramValueScaled = paramValue7Bit/26; break;
  case 0x42: // param 66    OSC2 Interval       (12)
  paramValueScaled = paramValue7Bit*24/256; break;
  case 0x28: // param 40    JStck PBend Range   (13)
  case 0x2A: // param 42    EQ Bass             (13)
  case 0x2B: // param 43    EQ Treble           (13)
  case 0x3C: // param 60    Max OSC Band Range  (13)
  paramValueScaled = paramValue7Bit*26/256; break;
  case 0x00: // param 0     OSC1 Level          (101)
  case 0x01: // param 1     OSC2 Level          (101)
  paramValueScaled = paramValue7Bit*203/256; break;
  default: return;
  }
  sysexData[2] = 0x30 | ((channel - 1) & 0x0f);
  sysexData[5] = paramNumber;
  sysexData[6] = paramValueScaled;
  MIDI.sendSysEx(sysexLen, sysexData, true);
}

void handleNoteOn(byte channel, byte note, byte velocity) {
  digitalWrite(ledPinOut, HIGH);//turn the LED on
  MIDI.sendNoteOn(note, velocity, channel);
}

void handleNoteOff(byte channel, byte note, byte velocity) {
  //Do something when the note is released.
  //Note that NoteOn messages with 0 velocity are interpreted as NoteOffs.
  digitalWrite(ledPinOut, LOW);//turn the LED off
  MIDI.sendNoteOff(note, velocity, channel);
}

void handleProgramChange(byte channel, byte number) {MIDI.sendProgramChange(number, channel);}
void handleAfterTouchChannel(byte channel, byte pressure) {MIDI.sendAfterTouch(pressure, channel);}
void handlePitchBend(byte channel, int bend) {MIDI.sendPitchBend(bend, channel);}

void handleSystemExclusive(byte* arrayData, unsigned arrayLen) {MIDI.sendSysEx(arrayLen, arrayData, true);}

void handleControlChange(byte channel, byte number, byte value) {
  if (channel != (dssCh + 1)) {//dssCh=0 is differ&less channel=1
      MIDI.sendControlChange(number, value, channel); return;
  }
  switch(number) {//Map of received CC# to corresponding paramNamb
      //Fader group
      case 0x00: sendDSS1Param_8(channel, 0, value); break;
      case 0x01: sendDSS1Param_8(channel, 1, value); break;
      case 0x02: sendDSS1Param_8(channel, 3, value); break;
      case 0x03: sendDSS1Param_8(channel, 63, value); break;
      case 0x04: sendDSS1Param_8(channel, 64, value); break;
      case 0x05: sendDSS1Param_8(channel, 2, value); break;
      case 0x06: sendDSS1Param_8(channel, 77, value); break;
      case 0x07: sendDSS1Param_8(channel, 20, value); break;
      case 0x08: sendDSS1Param_8(channel, 42, value); break;
      case 0x09: sendDSS1Param_8(channel, 43, value); break;
      case 0x0A: sendDSS1Param_8(channel, 21, value); break;
      case 0x0B: sendDSS1Param_8(channel, 22, value); break;
      case 0x0C: sendDSS1Param_8(channel, 23, value); break;
      case 0x0D: sendDSS1Param_8(channel, 24, value); break;
      case 0x0E: sendDSS1Param_8(channel, 25, value); break;
      case 0x0F: sendDSS1Param_8(channel, 26, value); break;
      //V-Coder group
      case 0x10: sendDSS1Param_8(channel, 58, value); break;
      case 0x11: sendDSS1Param_8(channel, 59, value); break;
      case 0x12: sendDSS1Param_8(channel, 62, value); break;
      case 0x13: sendDSS1Param_8(channel, 66, value); break;
      case 0x14: sendDSS1Param_8(channel, 65, value); break;
      case 0x15: sendDSS1Param_8(channel, 73, value); break;
      case 0x16: sendDSS1Param_8(channel, 74, value); break;
      case 0x17: sendDSS1Param_8(channel, 75, value); break;
      case 0x18: sendDSS1Param_8(channel, 6, value); break;
      case 0x19: sendDSS1Param_8(channel, 8, value); break;
      case 0x1A: sendDSS1Param_8(channel, 13, value); break;
      case 0x1B: sendDSS1Param_8(channel, 14, value); break;
      case 0x1C: sendDSS1Param_8(channel, 15, value); break;
      case 0x1D: sendDSS1Param_8(channel, 16, value); break;
      case 0x1E: sendDSS1Param_8(channel, 17, value); break;
      case 0x1F: sendDSS1Param_8(channel, 18, value); break;
      //Select SW group
      case 0x40: sendDSS1Param_8(channel, 38, value); break;
      case 0x41: sendDSS1Param_8(channel, 41, value); break;
      case 0x42: sendDSS1Param_8(channel, 61, value); break;
      case 0x43: sendDSS1Param_8(channel, 51, value); break;
      case 0x44: sendDSS1Param_8(channel, 57, value); break;
      case 0x45: sendDSS1Param_8(channel, 72, value); break;
      case 0x46: sendDSS1Param_8(channel, 4, value); break;
      case 0x47: sendDSS1Param_8(channel, 5, value); break;
      //        PC control messages (range 500)
      case 0x2e: sendDSS1Param_9(channel, 46, value); break;
      case 0x34: sendDSS1Param_9(channel, 52, value); break;
#if 0
      // Unmapped/reserved  Switch list
      //Select SW group
      case 0x48: sendDSS1Param_8(channel, , value); break;
      case 0x49: sendDSS1Param_8(channel, , value); break;
      case 0x4A: sendDSS1Param_8(channel, , value); break;
      case 0x4B: sendDSS1Param_8(channel, , value); break;
      case 0x4C: sendDSS1Param_8(channel, , value); break;
      case 0x4D: sendDSS1Param_8(channel, , value); break;
      case 0x4E: sendDSS1Param_8(channel, , value); break;
      case 0x4F: sendDSS1Param_8(channel, , value); break;
      //V-Coder Select group
      case 0x50: sendDSS1Param_8(channel, , value); break;
      case 0x51: sendDSS1Param_8(channel, , value); break;
      case 0x52: sendDSS1Param_8(channel, , value); break;
      case 0x53: sendDSS1Param_8(channel, , value); break;
      case 0x54: sendDSS1Param_8(channel, , value); break;
      case 0x55: sendDSS1Param_8(channel, , value); break;
      case 0x56: sendDSS1Param_8(channel, , value); break;
      case 0x57: sendDSS1Param_8(channel, , value); break;
      case 0x58: sendDSS1Param_8(channel, , value); break;
      case 0x59: sendDSS1Param_8(channel, , value); break;
      case 0x5A: sendDSS1Param_8(channel, , value); break;
      case 0x5B: sendDSS1Param_8(channel, , value); break;
      case 0x5C: sendDSS1Param_8(channel, , value); break;
      case 0x5D: sendDSS1Param_8(channel, , value); break;
      case 0x5E: sendDSS1Param_8(channel, , value); break;
      case 0x5F: sendDSS1Param_8(channel, , value); break;
#endif
      default: MIDI.sendControlChange(number, value, channel); break;
      }
  }

void setup() {pinMode(ledPinOut, OUTPUT); digitalWrite(ledPinOut, LOW);
  MIDI.setHandleNoteOn(handleNoteOn);
  MIDI.setHandleNoteOff(handleNoteOff);
  MIDI.setHandleControlChange(handleControlChange);
  MIDI.setHandleProgramChange(handleProgramChange);
  MIDI.setHandleAfterTouchChannel(handleAfterTouchChannel);
  MIDI.setHandlePitchBend(handlePitchBend);
  MIDI.setHandleSystemExclusive(handleSystemExclusive);
  MIDI.begin(MIDI_CHANNEL_OMNI);
  MIDI.turnThruOff();
}

void loop() {MIDI.read();}
```

  [1]: https://MIDI inplementation: https://dn790004.ca.archive.org/0/items/sm_DSS-1ServiceManual/DSS-1ServiceManual.pdf

title: Looking for best methods of remaking the code without changing its functionality, but reducing the code amount by ~10 times

Answers: 0


body:
I have a Arduino uno and Whenever I try to upload code it gives me this error

    Sketch uses 5804 bytes (17%) of program storage space. Maximum is 32256 bytes.
    Global variables use 238 bytes (11%) of dynamic memory, leaving 1810 bytes for local variables. Maximum is 2048 bytes.
    avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x30
    avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x0d
    avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x0a
    avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x32
    avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x0d
    avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x0a
    avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x34
    avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x0d
    avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x0a
    avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x36
    Failed uploading: uploading error: exit status 1
but the serial monitor shows the print message.

I have tried to change the cable,
I have tried to change the port,
I have tried to use and external power source,
I have tried to burn the bootloader

but the same error shows.

I have tried to change the Atmega microprocessor to another board which works so the problem is the boards itself.

title: Arduino Uno Carrier board not responding

Answers: 0


body:
I am new to Arduino and trying to cope with an assigment for my class, i am using an arduino Nano board and a potensiometer with 2 resistors as shown in the picture. I am trying to write a code which will read the analog signal from my circuit and convert it in mm. More specifically i need it to show -20 when the potensiometer is in 50 Ohms and 20 when it is set at 550 Ohms. I have spent a lot of time trying to figure out the code but havent been able to make it work yet. Any ideas would help for sure. Thanks for your time.

[![enter image description here][1]][1]

  [1]: https://i.stack.imgur.com/dCZt8.png

title: ARDUINO VOLTAGE DIVIDER Vx to mm

Answers: 0


body:
**Context**
I'm using an [Arduino Pro Micro clone][1] as a HID UPS device for my DIY UPS for my network rack (12V deep cycle batteries, an inverter, and a charger/converter). For the last several week I have one working correctly doing mains AC detection and reporting that to a Raspberry Pi running NUT.

The USB HID reports includes a "remaining capacity" value that is supposed to be a percentage from 0-100. So far, I've been running it with a hardcoded value of 99. But, I really want to do voltage detection on the batteries and convert to a percentage. The voltage range on the input side of the divider module will be 0-15VDC. For this question, assume I'm aware of the issues of using voltage as a stand in for remaining capacity. I want to focus on the Arduino-specific problem.

**My current problem**
With one Arduino happily working doing AC on/off detection and alerting NUT, I grabbed some [voltage divider modules][2], spent some time wiring things up, and then writing code. To test this, I'm using another Arduino on a breadboard. This is the same Arduino I used for the original prototyping, so I know it has worked. I know voltage dividers are easy to construct, but since I'm eventually mounting all this inside the case of another pieced of equipment, it's easier for me to use a pre-printed PCB with ferrule inputs and pin headers.

My connections for testing are:
* Arduino Pro Micro connected via USB to my PC. This is how I flash, get serial console and power the Arduino.
* One digital pin is pulled LOW to simulate my "AC present" signal. My AC detection module sets pulls pin low when AC is present.
* One digital pin connected to an LED and resistor that is set HIGH when my code things AC is missing.
* One digital pin connected to an LED and resistor that I use as a heartbeat. It is cycled alternately HIGH and LOW as loop() does it's thing.
* The voltage divider module above. It has a +, -, and S pins on its output side. Those are connected to VCC, GND, and A0 respectively.
* On the input side of the voltage divider I'm using a cheap switchmode benchtop PSU. Before ever connecting it, I set it to 12V and turned the current setting way down so it wouldn't output more than ~50mA. I also tested the output of the voltage divider with a known good multimeter and confirmed it is 1/5th of the input voltage as expected.

For several hours, I made good progress, got my code working, learning about voltage references and the ADC. At various times I had A0 giving me a value close to what I was expecting. Because VCC is not exactly 5V, I even went down a rabbit whole try to read VCC programmatically so I'd have better values to convert the A0 pin value to the expect input voltage (used this guide: https://www.chrisbot.com/measuring-vcc-on-arduino-micro-atmega32u4/). The important part here is this was working both with an assumed value of 5V for VCC and with the method described at that link.

At some point, I wanted to test if the "grab VCC dynamically" code worked after powering the Arduino off and on. I unplugged the Arduino from the computer's USB and now I can no longer get the Arduino to run if the bench top PSU is on. Being specific:

* Arduino plugged into computer USB with all connections described above but bench top PSU off: Sketch runs, heartbeats, I see serial console output.
* As soon as I switch on the PSU, I see: "!!!!!!!!!!!!!!!!!" on the serial console and the PC detect the USB as disconnected and the heartbeat LED stops.
* If I turn the PSU on first, then plug the Arduino into USB, it never starts. I see the small red power LED on the Arduino, but no USB connection, no heartbeat LED from my sketch.

With my DMM, I have verified the output side of the voltage divider module is ~2.4V when PSU is set to 12V. I don't think I'm powering the Arduino "through" the voltage divider module, The bench top PSU shows 0.0A and the Arduino shows no activity lights when it is connected just to the voltage divider and not USB.

I tried powering the Arduino from another source, I've got an Arduino breadboard PSU thing that takes 12VDC input from a wall wart barrel jack and provides ~5V on the +/- rails of the breadboard, which I have jumpered to the RAW and GND pins on the Arduino. Powering it this way has the same behavior, as soon as the PSU that is providing the simulated ~12V battery voltage is turned on, the USB disconnects and the Arduino appears to freeze.

Any help, pointers for debugging, etc is appreciated. I suspect there's a ground loop. But, I thought I would post here to check. In my application, the Arduino needs to be connected to a USB host, right now I'm letting it power itself over USB, but I guess I could power it using a 5V regulator that uses the same voltage source as what the voltage divider module is using. But...I'll STILL have to plug the Arduino into the Raspberry Pi's USB port. Do I have to power It from the same 5V source as the Arduino?

  [1]: https://www.amazon.com/gp/product/B01MTU9GOB
  [2]: https://www.amazon.com/gp/product/B01HTC4XKY

title: Ground loop between USB and voltage divider connected to A0?

Answers: 0