After using NessoN1 on the issued USB cable and successfully compiling, uploading and running many sketches, I started working on my "tones" section using tone() in setup() when NessoN1 rebooted and restarted setup().
I tried another tone() sketch and the sketch worked without issue.
the "good" sketch
/*
sit - SPECIAL INFORMATION TONE
(Frequency Hz) Cadence (S): (913.8) 0.274 ON (1370.6) 0.274 ON (1776.7) 0.38 ON 1.0 OFF.
https://en.wikipedia.org/wiki/Special_information_tone
*/
char text[] = { "We're sorry. You have reached a number that has been disconnected or is no longer in service. If you feel you have reached this recording in error, please check the number, and try your call again." };
int textsize = sizeof(text) / sizeof(text[0]);
float sitfreq[] = { 913.8, 1370.6, 1776.7, 0 };
int duration[] = { 274, 274, 380, 1000 };
unsigned long timer;
byte i;
byte slowbaud = 40; // teletype effect
void setup() {
Serial.begin(115200);
delay(1000);
Serial.println();
pinMode(BEEP_PIN, OUTPUT);
}
void loop() {
printText();
}
void printText() {
if (millis() - timer > slowbaud) { // slow text output
timer = millis();
if (i == textsize - 1) {
Serial.println();
makeTone(); // text complete, now tone
i = 0;
}
Serial.print(text[i]);
i++;
}
}
void makeTone() {
delay(250);
for (byte i = 0; i < 4; i++) {
tone(BEEP_PIN, sitfreq[i]);
delay(duration[i]);
}
noTone(BEEP_PIN);
}
I tried a third tone() sketch and got this crash, reboot, and warning...
0E BOD: Brownout detector was triggered
ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x3 (LP_SW_HPSYS),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4001974a
SPIWP:0xee
mode:DIO, clock div:2
load:0x40875730,len:0x12e0
load:0x4086b910,len:0xdc8
load:0x4086e610,len:0x3180
entry 0x4086b910
One of the "bad" sketches
// passive buzzer musical scales
// keyboard scale: https://i.pinimg.com/originals/cf/72/9a/cf729ae2213a849fe6b8cc527a0e7471.png
#include <Arduino_Nesso_N1.h>
#include "freqs.h" // adapted from pitches.h: https://gist.github.com/mikeputnam/2820675
int duration, dur = 200;
const int notes = 10;
const int scales = 12;
const int scale[scales][notes] = {
// N = natural S = sharp
// O- W W H W W H W W S // Octave lower, Whole-step, Half-step
{ CN3, CN4, DN4, EN4, FN4, GN4, FN4, EN4, DN4, CN4 }, // C
{ CS3, CS4, DS4, FN4, FS4, GS4, FS4, FN4, DS4, CS4 }, // C#
{ DN3, DN4, EN4, FS4, GN4, AN4, GN4, FS4, EN4, DN4 }, // D
{ DS3, DS4, FN4, GN4, GS4, AS4, GS4, GN4, FN4, DS4 }, // D#
{ EN3, EN4, FS4, GS4, AN4, BN4, AN4, GS4, FS4, EN4 }, // E
{ FN3, FN4, GN4, AN4, AS4, CN5, AS4, AN4, GN4, FN4 }, // F
{ FS3, FS4, GS4, AS4, BN4, CS5, BN4, AS4, GS4, FS4 }, // F#
{ GN3, GN4, AN4, BN4, CN5, DN5, CN5, BN4, AN4, GN4 }, // G
{ GS3, GS4, AS4, CN5, CS5, DS5, CS5, CN5, AS4, GS4 }, // G#
{ AN3, AN4, BN4, CS5, DN5, EN5, DN5, CS5, BN4, AN4 }, // A
{ AS3, AS4, CN5, DN5, DS5, FN5, DS5, DN5, CN5, AS4 }, // A#
{ BN3, BN4, CS5, DS5, EN5, FS5, EN5, DS5, CS5, BN4 } // B
};
void setup() {
Serial.begin(115200);
delay(3000); // Nesso needs a delay to connect before output to Serial Monitor
Serial.println();
pinMode(KEY1, INPUT_PULLUP);
Serial.println("Press KEY1");
while (digitalRead(KEY1)) {}; // wait for KEY1 press
delay(500); // slight delay
for (byte j = 0; j < scales; j++) {
if (j + 1 < 10)
Serial.print(" "); // alignment
Serial.print(j + 1); // counting numbers
Serial.print(" of ");
Serial.print(scales);
Serial.print(" scales in fifths: ");
for (byte i = 0; i < notes; i++) {
Serial.print(i);
if (i == 0 || i == 9) // first and last note in scale
duration = dur * 2; // double note duration
else
duration = dur;
tone(BEEP_PIN, scale[j][i], duration);
delay(duration);
}
noTone(BEEP_PIN); // end tone
Serial.println();
}
}
void loop() {}
Reading the forum... one solution was "bad USB cable"... not the problem here... another was "setting fuses on the ESP32".... um... would Arduino do that to Nesso?... another was a peripheral was pulling the ESP into brownout... and this one was something with "Wire.h" (maybe interrupts shared with Wire.h and tone()?
Maybe I found the magic "brown-note" (musicians might know about it)... but I want to avoid it. My plan is to step through every note I have tried to produce, looking for that m*.
Sorry for breaking Nesso every day.