<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Arduino 8 step sequencer - Help Wanted				            </title>
            <link>https://forum.dronebotworkshop.com/help-wanted/arduino-8-step-sequencer/</link>
            <description>Discussion board for Robotics, Arduino, Raspberry Pi and other DIY electronics and modules. Join us today!</description>
            <language>en-US</language>
            <lastBuildDate>Thu, 12 Nov 2026 19:05:12 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Arduino 8 step sequencer</title>
                        <link>https://forum.dronebotworkshop.com/help-wanted/arduino-8-step-sequencer/#post-17347</link>
                        <pubDate>Tue, 09 Mar 2021 01:14:14 +0000</pubDate>
                        <description><![CDATA[A better video of it, the original one was the wrong orientation sorry!
couldn&#039;t figure out how to edit my previous post]]></description>
                        <content:encoded><![CDATA[<p><a href="https://youtu.be/3Z27aTp8DSo" target="true">A better video</a> of it, the original one was the wrong orientation sorry!</p>
<p>couldn't figure out how to edit my previous post</p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/help-wanted/">Help Wanted</category>                        <dc:creator>Existential_Fred</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/help-wanted/arduino-8-step-sequencer/#post-17347</guid>
                    </item>
				                    <item>
                        <title>Arduino 8 step sequencer</title>
                        <link>https://forum.dronebotworkshop.com/help-wanted/arduino-8-step-sequencer/#post-17344</link>
                        <pubDate>Mon, 08 Mar 2021 19:15:21 +0000</pubDate>
                        <description><![CDATA[HI everyone, 
Any of you guys into making synths and noise making devices?
I&#039;m working on a sequencer at the moment, it plays different modes and different keys.
its mostly bits of code f...]]></description>
                        <content:encoded><![CDATA[<p>HI everyone, </p>
<p>Any of you guys into making synths and noise making devices?</p>
<p>I'm working on a sequencer at the moment, it plays different modes and different keys.</p>
<p>its mostly bits of code from different examples I've cobbled together, its based on the tone melody example from the arduino ide. I hoped you guys might be able to help refine the code a bit,</p>
<p> </p>
<p>its all working ok but could be better, there are 3 small issues</p>
<p>1 lots of the code is repeated so maybe it needs a function or two adding in. </p>
<p>2 the tempo control wanders a bit and it would be nice if it could be set to a specific bpm</p>
<p>3 the noTone is not actually silent you can hear some weird background static.</p>
<p><br />Anyway thought id ask to see if there are any obvious changes I could make before I solder it all together<br /><br />Here is a video of it on action <a title="8 step sequencer" href="https://youtu.be/N1HCdhpoQL4" target="true">8 step sequencer</a><br /><br />really want to incorporate the mozzi library into it at some point but thats a long way off<br /><br />Thanks!</p>
<pre>
//#include &lt;Arduino.h&gt;<br />#include "pitches.h"<br />#include &lt;LedControl.h&gt;<br />#define tempoPot A0<br /><br />#include "ssd1306.h"<br />#include "nano_gfx.h"<br />#include "sova.h"<br /><br />//#define modeSelector A1<br />/*<br />* speaker connected to pin 8<br />* matrix to arduino:-<br />* vcc to 5v<br />* gnd to ground<br />* din to d11<br />* cs to d10<br />* clk to d13<br />*/<br />// ERROR HERE IN PLATFORMIO BUT NOT IN ARDUINO IDE?<br />LedControl lc=LedControl(11,13,10,1); // see above notes for wiring, <br />//1 is how many matrix are connected<br /><br />//the notes of C lydian, this will eventually be a 3d array containing all of the modes in all keys <br />const int notes[] = {<br />NOTE_B0, <br />NOTE_C1, <br />NOTE_CS1, <br />NOTE_D1, <br />NOTE_DS1, <br />NOTE_E1, <br />NOTE_F1, <br />NOTE_FS1, <br />NOTE_G1, <br />NOTE_GS1, <br />NOTE_A1, <br />NOTE_AS1, <br />NOTE_B1, <br />NOTE_C2, <br />NOTE_CS2, <br />NOTE_D2, <br />NOTE_DS2, <br />NOTE_E2, <br />NOTE_F2, <br />NOTE_FS2, <br />NOTE_G2, <br />NOTE_GS2, <br />NOTE_A2, <br />NOTE_AS2, <br />NOTE_B2, <br />NOTE_C3, <br />NOTE_CS3, <br />NOTE_D3, <br />NOTE_DS3, <br />NOTE_E3, <br />NOTE_F3, <br />NOTE_FS3, <br />NOTE_G3, <br />NOTE_GS3, <br />NOTE_A3, <br />NOTE_AS3, <br />NOTE_B3, <br />NOTE_C4, <br />NOTE_CS4, <br />NOTE_D4, <br />NOTE_DS4, <br />NOTE_E4, <br />NOTE_F4, <br />NOTE_FS4, <br />NOTE_G4, <br />NOTE_GS4, <br />NOTE_A4, <br />NOTE_AS4, <br />NOTE_B4, <br />NOTE_C5, <br />NOTE_CS5, <br />NOTE_D5, <br />NOTE_DS5, <br />NOTE_E5, <br />NOTE_F5, <br />NOTE_FS5, <br />NOTE_G5, <br />NOTE_GS5, <br />NOTE_A5, <br />NOTE_AS5, <br />NOTE_B5, <br />NOTE_C6, <br />NOTE_CS6, <br />NOTE_D6, <br />NOTE_DS6, <br />NOTE_E6, <br />NOTE_F6, <br />NOTE_FS6, <br />NOTE_G6, <br />NOTE_GS6, <br />NOTE_A6, <br />NOTE_AS6, <br />NOTE_B6, <br />NOTE_C7, <br />NOTE_CS7, <br />NOTE_D7, <br />NOTE_DS7, <br />NOTE_E7, <br />NOTE_F7, <br />NOTE_FS7, <br />NOTE_G7, <br />NOTE_GS7, <br />NOTE_A7, <br />NOTE_AS7, <br />NOTE_B7, <br />NOTE_C8, <br />NOTE_CS8, <br />NOTE_D8, <br />NOTE_DS8 <br />};<br /><br />const int modeTemplate {<br />{0, 2, 4, 5, 7, 9, 11, 12, noTone}, //Ionian w, w, h, w, w, w, h<br />{0, 2, 3, 5, 7, 9, 10, 12, noTone}, //Dorian<br />{0, 1, 3, 5, 7, 8, 10, 12, noTone}, //Phrygian<br />{0, 2, 4, 6, 7, 9, 11, 12, noTone}, // Lydian<br />{0, 2, 4, 5, 7, 9, 10, 12, noTone}, // Mixolydian<br />{0, 2, 3, 5, 7, 8, 10, 12, noTone}, // Aeolian<br />{0, 1, 3, 5, 6, 8, 10, 12, noTone}, //Locrian<br />};<br /><br />int rest; // rest inbetween notes, acting as tempo control in this case<br /><br />//holds the data to set the tempo<br />int tempoVal;<br /><br />// to hold the mode state<br />int mode = 0;<br /><br />//holds the key state (starting note aka root note)<br />int key = 37;<br /><br />//hold the number of steps or beats<br />int beat = 8;<br /><br />//debounce time<br />int debounce = 1;<br /><br />// variable to hold the button states<br />int b1s = 0;<br />int b2s = 0;<br />int b3s = 0;<br />int b4s = 0;<br />int b5s = 0;<br />int b6s = 0;<br />int b7s = 0;<br />int b8s = 0;<br /><br />// assigning buttons to pins<br />// buttons connected from pin to ground with 10k pulldown resistor<br />const int b1 = 2;<br />const int b2 = 3;<br />const int b3 = 4;<br />const int b4 = 5;<br />const int b5 = 6;<br />const int b6 = 7;<br />const int b7 = 8;<br />const int b8 = 9;<br /><br />// button to select modes, keys and beats<br />const int keyPin = A1;<br />const int modePin = A2;<br />const int beatPin = A3;<br /><br />//setting up the speaker<br />const int speaker = 12;<br /><br /><br />void setup() {<br />/*<br />The MAX72XX is in power-saving mode on startup,<br />we have to do a wakeup call<br />*/<br />lc.shutdown(0,false);<br />/* Set the brightness to a medium values */<br />lc.setIntensity(0,8);<br />/* and clear the display */<br />lc.clearDisplay(0);<br /><br />// buttons to change the notes<br />pinMode(b1, INPUT);<br />pinMode(b2, INPUT);<br />pinMode(b3, INPUT);<br />pinMode(b4, INPUT);<br />pinMode(b5, INPUT);<br />pinMode(b6, INPUT);<br />pinMode(b7, INPUT);<br />pinMode(b8, INPUT);<br /><br />// button to change the modes<br />pinMode(modePin, INPUT);<br />pinMode(keyPin, INPUT);<br />pinMode(beatPin, INPUT);<br /><br />//oled stuff<br /><br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br /><br />ssd1306_128x64_i2c_init();<br />// ssd1306_128x64_spi_init(-1, 0, 1); // Use this line for nano pi (RST not used, 0=CE, gpio1=D/C)<br />// ssd1306_128x64_spi_init(3,4,5); // Use this line for Atmega328p (3=RST, 4=CE, 5=D/C)<br />// ssd1306_128x64_spi_init(24, 0, 23); // Use this line for Raspberry (gpio24=RST, 0=CE, gpio23=D/C)<br />// ssd1306_128x64_spi_init(22, 5, 21); // Use this line for ESP32 (VSPI) (gpio22=RST, gpio5=CE for VSPI, gpio21=D/C)<br />// composite_video_128x64_mono_init(); // Use this line for ESP32 with Composite video support<br /><br />ssd1306_clearScreen();<br /><br />}<br /><br />void loop() {<br /><br />Serial.begin(9600);<br /><br />// the tempo section <br />tempoVal = analogRead(tempoPot);<br />tempoVal = map(tempoVal, 1, 1024, 1, 255);<br />rest = tempoVal*2;<br />//Serial.println(tempoVal);<br /><br /><br /><br /><br />// the amount of beats<br />for (int x = 0; x &lt; beat; x++){<br /><br />//checking for mode button press<br />int modeSelector = digitalRead(modePin);<br />int keySelector = digitalRead(keyPin);<br />int beatSelector = digitalRead(beatPin);<br /><br />//selecting the mode<br />if (modeSelector == 1){<br />delay(debounce);<br />mode++;<br />if (mode &gt; 6){<br />mode = 0;<br />}<br />}<br /><br />//selecting the key<br />if (keySelector == 1){<br />delay(debounce);<br />key++;<br />if (key &gt; 89){<br />key = 0;<br />}<br />}<br /><br />//selecting the number of steps (beats)<br />if (beatSelector == 1){<br />delay(debounce);<br />beat--;<br />if (beat &lt; 1){<br />beat = 8;<br />}<br />}<br />// display the key <br />switch (key % 12){<br />case 0:<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 32, "B ", STYLE_NORMAL);<br />break;<br />case 1:<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 32, "C ", STYLE_NORMAL);<br />break;<br />case 2:<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 32, "C# ", STYLE_NORMAL);<br />break;<br />case 3:<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 32, "D ", STYLE_NORMAL);<br />break;<br />case 4:<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 32, "D# ", STYLE_NORMAL);<br />break;<br />case 5:<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 32, "E ", STYLE_NORMAL);<br />break;<br />case 6:<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 32, "F ", STYLE_NORMAL);<br />break;<br />case 7:<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 32, "F# ", STYLE_NORMAL);<br />break;<br />case 8:<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 32, "G ", STYLE_NORMAL);<br />break;<br />case 9:<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 32, "G# ", STYLE_NORMAL);<br />break;<br />case 10:<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 32, "A ", STYLE_NORMAL);<br />break;<br />case 11:<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 32, "A# ", STYLE_NORMAL);<br />break;<br /><br />}<br /><br />//reading the mode select button and displaying it on the screen<br />switch(mode) {<br />case 0:<br />//ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 16, "Ionian ", STYLE_NORMAL);<br />break;<br />case 1:<br />//ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 16, "Dorian ", STYLE_NORMAL);<br />break;<br />case 2:<br />// ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 16, "Phrygian ", STYLE_NORMAL);<br />break;<br />case 3:<br />//ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 16, "Lydian ", STYLE_NORMAL);<br />break;<br />case 4:<br />//ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 16, "Mixolydian ", STYLE_NORMAL);<br />break;<br />case 5:<br />// ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 16, "Aeolian ", STYLE_NORMAL);<br />break;<br />default:<br />// ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 16, "Locrian ", STYLE_NORMAL);<br />}<br /><br />Serial.print(mode); <br />//updating the button counters when the buttons are pressed<br />//these variables hold the note info<br />//each time a button is pressed bxst goes up by 1<br />//this corresponds to the note array position<br />int b1st = digitalRead(b1);<br />int b2st = digitalRead(b2);<br />int b3st = digitalRead(b3);<br />int b4st = digitalRead(b4);<br />int b5st = digitalRead(b5);<br />int b6st = digitalRead(b6);<br />int b7st = digitalRead(b7);<br />int b8st = digitalRead(b8);<br /><br />//this section calculates the notes of each beat<br />//if a button press is sensed then it increments the note by one<br /><br />if (b1st == 1){<br />delay(debounce);<br />b1s++;<br />if (b1s == 9){ // if it goes past the end of the array, go back to the start<br />b1s = 0;<br />}<br />}<br /><br />if (b2st == 1){<br />delay(debounce);<br />b2s++;<br />if (b2s == 9){<br />b2s = 0;<br />}<br />}<br />if (b3st == 1){<br />delay(debounce);<br />b3s++;<br />if (b3s == 9){<br />b3s = 0;<br />}<br />}<br />if (b4st == 1){<br />delay(debounce);<br />b4s++;<br />if (b4s == 9){<br />b4s = 0;<br />}<br />}<br />if (b5st == 1){<br />delay(debounce);<br />b5s++;<br />if (b5s == 9){<br />b5s = 0;<br />}<br />}<br />if (b6st == 1){<br />delay(debounce);<br />b6s++;<br />if (b6s == 9){<br />b6s = 0;<br />}<br />}<br />if (b7st == 1){<br />delay(debounce);<br />b7s++;<br />if (b7s == 9){<br />b7s = 0;<br />}<br />}<br />if (b8st == 1){<br />delay(debounce);<br />b8s++;<br />if (b8s == 9){<br />b8s = 0;<br />}<br />}<br /><br />//this section turns on the correct led on the matrix and plays the tone<br />//left to right shows the beats<br />//bottom to top shows which note is selected from the notes array<br /><br />//ssd1306_clearScreen();<br />if (x == 0){<br />lc.setLed(0,0,b1s, true); //sets the correct led on the 8*8 matrix<br />int thisKey1 = key + modeTemplate; <br />int thisNote1 = notes;<br />if (b1s == 8){<br />thisNote1 = 99999999;<br />}<br />tone(speaker, thisNote1);<br />// Serial.print(thisMode1);<br />// Serial.print(thisKey1);<br />Serial.print(thisNote1);<br /><br /><br />//ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 0, "Step 1", STYLE_NORMAL);<br />delay(rest);<br />lc.setLed(0,0,b1s ,false);<br />}<br /><br />else if (x == 1){<br />lc.setLed(0,1,b2s,true);<br />int thisKey2 = key + modeTemplate;<br />int thisNote2 = notes;<br />if (b2s == 8){<br />thisNote2 = 99999999;<br />}<br />tone(speaker, thisNote2);<br />Serial.println(key);<br /><br />//ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 0, "Step 2", STYLE_NORMAL);<br />delay(rest);<br />lc.setLed(0,1,b2s,false);<br />}<br /><br />else if (x == 2){<br />lc.setLed(0,2,b3s,true);<br />int thisKey3 = key + modeTemplate;<br />int thisNote3 = notes;<br />if (b3s == 8){<br />thisNote3 = 99999999;<br />}<br />tone(speaker, thisNote3);<br /><br />//ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 0, "Step 3", STYLE_NORMAL);<br />delay(rest);<br />lc.setLed(0,2,b3s,false);<br />}<br /><br />else if (x == 3){<br />lc.setLed(0,3,b4s,true);<br />int thisKey4 = key + modeTemplate;<br />int thisNote4 = notes;<br />if (b4s == 8){<br />thisNote4 = 99999999;<br />} tone(speaker, thisNote4);<br /><br />//ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 0, "Step 4", STYLE_NORMAL);<br />delay(rest);<br />lc.setLed(0,3,b4s,false);<br />}<br /><br />else if (x == 4){<br />lc.setLed(0,4,b5s,true);<br />int thisKey5 = key + modeTemplate;<br />int thisNote5 = notes;<br />if (b5s == 8){<br />thisNote5 = 99999999;<br />}<br />tone(speaker, thisNote5);<br /><br />//ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 0, "Step 5", STYLE_NORMAL);<br />delay(rest);<br />lc.setLed(0,4,b5s,false);<br />}<br /><br />else if (x == 5){<br />lc.setLed(0,5,b6s,true);<br />int thisKey6 = key + modeTemplate;<br />int thisNote6 = notes;<br />if (b6s == 8){<br />thisNote6 = 99999999;<br />}<br />tone(speaker, thisNote6);<br /><br />//ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 0, "Step 6", STYLE_NORMAL);<br />delay(rest);<br />lc.setLed(0,5,b6s,false);<br />}<br /><br />else if (x == 6){<br />lc.setLed(0,6,b7s,true);<br />int thisKey7 = key + modeTemplate;<br />int thisNote7 = notes;<br />if (b7s == 8){<br />thisNote7 = 99999999;<br />}<br />tone(speaker, thisNote7);<br /><br />//ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 0, "Step 7", STYLE_NORMAL);<br />delay(rest);<br />lc.setLed(0,6,b7s,false);<br />}<br /><br />else {<br />lc.setLed(0,7,b8s,true);<br />int thisKey8 = key + modeTemplate;<br />int thisNote8 = notes;<br />if (b8s == 8){<br />thisNote8 = 99999999;<br />}<br />tone(speaker, thisNote8);<br /><br />//ssd1306_clearScreen();<br />ssd1306_setFixedFont(ssd1306xled_font8x16);<br />ssd1306_printFixed(0, 0, "Step 8", STYLE_NORMAL);<br />delay(rest);<br />lc.setLed(0,7,b8s,false);<br />}<br />}<br />}</pre>
<p> </p>
<pre></pre>
<p> </p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/help-wanted/">Help Wanted</category>                        <dc:creator>Existential_Fred</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/help-wanted/arduino-8-step-sequencer/#post-17344</guid>
                    </item>
							        </channel>
        </rss>
		