Wednesday, September 30, 2020

Gadgets - An Octal Clock

 

I have always been fascinated with using colors to represent numeric data, and finally brought this idea to fruition with a four "digit" clock. Why octal? Because I haven't been able to reliably distinguish ten colors. The colors used - representing zero through seven -  are white, red, orange, yellow, green, aqua (cyan), blue, and magenta, rendered on neopixels. The image above shows orange-aqua : magenta-white, ie 25:70 in octal, which is (2x7)+5: 7x7 in decimal ie 19:49 (7.49 for 12 hour folk).

The container is 3D printed. The front face has a series of thick cones printed into the back of it, preventing light bleed to the adjacent spots, each of which is a seat for a neopixel. The back contains a USB power inlet and buttons to set hours and minutes. The processor is an arduino nano, conveniently getting the power, and it is connected to a real time clock as well as the neopixels. 

 

Code and hookup details below:


// Octal clock. Hours and minutes each represented by two color lights hhmm
// digits represented by colors 0=white, 1=red, 2=orange, 3=yellow, 4= green
// 5=aqua, 6=blue, 7 = magenta
// Date and time functions using a DS3231 RTC connected via I2C and Wire lib
#include <Wire.h>
#include "RTClib.h"
RTC_DS3231 rtc;
// adafruit neopixel 4 pixels
// wiring: d8 to hour button, NO to ground; d5 to neopixel; d9 to minute button NO to ground
// wiring: a5 to SCL; a4 to SDA on 3231
#include <Adafruit_NeoPixel.h>
#define PIN 5
Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, PIN, NEO_GRB + NEO_KHZ800);
#define HOUR_PIN 8
#define MINUTE_PIN 9
//#define SET_PIN 7
#define DEBOUNCE_DELAY 10
#define MAX_BUTTONS_INPUT 20
// 3 one dimensional arrays to hold color values
//numbers 0   1   2  3   4   5   6   7
// colors w   r   o  y   g   c   b   m
int r[]={40 ,110,100,70 ,0  ,0  ,0  ,70 };
int g[]={36 ,0  ,15 ,60 ,90 ,60 ,0  ,0  };
int b[]={20 ,0  ,0  ,0  ,0  ,15 ,100,60 };

void setup () {
  Serial.begin(9600);
  rtc.begin();
  rtc.adjust(DateTime(2014, 1, 21, 21, 57, 30)); //Plug in clock at correct time, no need for resets
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'

  pinMode(HOUR_PIN, INPUT_PULLUP);
  pinMode(MINUTE_PIN, INPUT_PULLUP);
  //pinMode(SET_PIN, INPUT_PULLUP);
}

  int lastButtonValue[MAX_BUTTONS_INPUT];
  int currentButtonValue[MAX_BUTTONS_INPUT];


void loop () {
 
  //int set_button = debounce(SET_PIN);not used in this implementation
  int hour_button = debounce(HOUR_PIN);
  int minute_button = debounce(MINUTE_PIN);
 
 
  if(hour_button && hasChanged(HOUR_PIN))
  {
    DateTime newTime = DateTime(rtc.now().unixtime()+3600);//blocks of 1 hour
    rtc.adjust( newTime );
  }
  if(minute_button && hasChanged(MINUTE_PIN))
  {
    DateTime newTime = DateTime(rtc.now().unixtime()+60);//blocks of 1 minute
    rtc.adjust( newTime );
  }
 
 
    DateTime now = rtc.now();
    
 
    //int s=now.second();
    int m=d2o(now.minute());//get octal value of minutes
    int h=d2o(now.hour());//get octal value of hours

    //split into individual digits
    
    int m1=(m/10);
    int m0=(m-10*(m/10));
    int h1=(h/10);
    int h0=(h-10*(h/10));
    int c[]={h1,h0,m1,m0};
    
//    Serial.println (h0);
//    Serial.println (m1);
//    Serial.println (m0);

    strip.setPixelColor(0, r[h1],g[h1],b[h1]); //h1, hour 10s
    strip.setPixelColor(1, r[h0],g[h0],b[h0]); //h0, hour 1s
    strip.setPixelColor(2, r[m1],g[m1],b[m1]); // m1, min 10s
    strip.setPixelColor(3, r[m0],g[m0],b[m0]); //mo, min 1s

   
    strip.show();

    delay(300);
    
    //cleanup (not needed in this implementation)
   
//    strip.setPixelColor(0, 0,0,0);
//    strip.setPixelColor(1, 0,0,0);
//    strip.setPixelColor(2, 0,0,0);
//    strip.setPixelColor(3, 0,0,0);
//    
    //strip.show();
}

//end of main loop

//functions

int debounce(int pin) //inverting output for internal pullup
{
  int val = !digitalRead(pin);
  if( val == lastButtonValue[pin] )
  {
    currentButtonValue[pin] = val;
    return val;
  }
    
  delay(DEBOUNCE_DELAY);
 
  val = !digitalRead(pin);
  if( val != lastButtonValue[pin] )
  {
    currentButtonValue[pin] = val;
    return val;
  }
 
  currentButtonValue[pin] = lastButtonValue[pin];
  return lastButtonValue[pin];
}

boolean hasChanged(int pin)
{
  return lastButtonValue[pin] != currentButtonValue[pin];
}

int d2o(int decimalnum) //decimal to octal conversion
{
    int octalnum = 0, temp = 1;

    while (decimalnum != 0)
    {
      octalnum = octalnum + (decimalnum % 8) * temp;
      decimalnum = decimalnum / 8;
        temp = temp * 10;
    }

    return octalnum;
}

Sunday, September 23, 2018

Gadgets - Midi USB keyboard


I'm not a musician, but always fascinated with electronic music and portable music tools. Yes I could use an ipad.. but why not make a usb midi keyboard?

Midi keyboards take up a lot of room. Full keys take up 7 inches per octave. So I  wanted to stagger two octaves to make a more packable dimension. Octave up/down keys are included to cover the 88 key range. There is no force sensing, just simple on off. Overall dimensions are ~ 6"x3"x1". Power comes from the usb connection to the box.



Teensyduino have a great line of boards programmable through arduino using more modern chips. They can all do direct usb out and pretend to be HID - so you can make plug and play mice, midi, keyboards etc.This is done with the $10 Teensy LC - a 32 bit machine with 26 io - way more juice than an arduino.


The keys use non-clicky cherry mx red knockoffs (I tried clicky blue ones but the noise was annoying). These are nice to use in 3D printing, they pop neatly into 14mm square holes.


Housing is all home 3D printed. Code is here:

/* Buttons to USB MIDI 2 octave kbd
You must select MIDI from the "Tools > USB Type" menu
To view the raw MIDI data on Linux: aseqdump -p "Teensy MIDI"
Adapted from Teensy example code in the public domain.
Buttons 0-23 are two octaves
Buttons 24 and 25 are octave up/down buttons
Button 24+25 is all sound off
Humphrey Gardner 2017
*/

#include <Bounce.h>

// the MIDI channel number to send messages
const int channel = 1;
int oct=0;
// Create Bounce objects for each button.  The Bounce object
// automatically deals with contact chatter or "bounce", and
// it makes detecting changes very simple.
Bounce button0 = Bounce(0, 5);
Bounce button1 = Bounce(1, 5);  // 5 = 5 ms debounce time
Bounce button2 = Bounce(2, 5);  // which is appropriate for good
Bounce button3 = Bounce(3, 5);  // quality mechanical pushbuttons
Bounce button4 = Bounce(4, 5);
Bounce button5 = Bounce(5, 5);  // if a button is too "sensitive"
Bounce button6 = Bounce(6, 5);  // to rapid touch, you can
Bounce button7 = Bounce(7, 5);  // increase this time.
Bounce button8 = Bounce(8, 5);
Bounce button9 = Bounce(9, 5);
Bounce button10 = Bounce(10, 5);
Bounce button11 = Bounce(11, 5);
Bounce button12 = Bounce(12, 5);
Bounce button13 = Bounce(13, 5); 
Bounce button14 = Bounce(14, 5); 
Bounce button15 = Bounce(15, 5); 
Bounce button16 = Bounce(16, 5);
Bounce button17 = Bounce(17, 5); 
Bounce button18 = Bounce(18, 5); 
Bounce button19 = Bounce(19, 5); 
Bounce button20 = Bounce(20, 5);
Bounce button21 = Bounce(21, 5);
Bounce button22 = Bounce(22, 5);
Bounce button23 = Bounce(23, 5);
Bounce button24 = Bounce(24, 5);
Bounce button25 = Bounce(25, 5);
Bounce button26 = Bounce(26, 5);
void setup() {
//Pullup removes need for external components
  pinMode(0, INPUT_PULLUP);
  pinMode(1, INPUT_PULLUP);
  pinMode(2, INPUT_PULLUP);
  pinMode(3, INPUT_PULLUP);
  pinMode(4, INPUT_PULLUP);
  pinMode(5, INPUT_PULLUP);
  pinMode(6, INPUT_PULLUP);
  pinMode(7, INPUT_PULLUP);
  pinMode(8, INPUT_PULLUP);
  pinMode(9, INPUT_PULLUP);
  pinMode(10, INPUT_PULLUP);
  pinMode(11, INPUT_PULLUP);
  pinMode(12, INPUT_PULLUP);
  pinMode(13, INPUT_PULLUP);
  pinMode(14, INPUT_PULLUP);
  pinMode(15, INPUT_PULLUP);
  pinMode(16, INPUT_PULLUP);
  pinMode(17, INPUT_PULLUP);
  pinMode(18, INPUT_PULLUP);
  pinMode(19, INPUT_PULLUP);
  pinMode(20, INPUT_PULLUP);
  pinMode(21, INPUT_PULLUP);
  pinMode(22, INPUT_PULLUP);
  pinMode(23, INPUT_PULLUP);
  pinMode(24, INPUT_PULLUP);
  pinMode(25, INPUT_PULLUP);
  pinMode(26, INPUT_PULLUP);
}
void loop() {
  // Update all the buttons.  There should not be any long
  // delays in loop(), so this runs repetitively at a rate
  // faster than the buttons could be pressed and released.
  button0.update();
  button1.update();
  button2.update();
  button3.update();
  button4.update();
  button5.update();
  button6.update();
  button7.update();
  button8.update();
  button9.update();
  button10.update();
  button11.update();
  button12.update();
  button13.update();
  button14.update();
  button15.update();
  button16.update();
  button17.update();
  button18.update();
  button19.update();
  button20.update();
  button21.update();
  button22.update();
  button23.update();
  button24.update();
  button25.update();
  button26.update();
  // Check each button for "rising" edge.
  // Send a MIDI Note On message when each button presses
  // Update the Joystick buttons only upon changes.
  // rising = high (not pressed - voltage from pullup resistor)
  //           to low (pressed - button connects pin to ground)
  if (button0.fallingEdge()) {
    usbMIDI.sendNoteOn(60+oct, 99, channel);  // 60 = C4
  }
  if (button1.fallingEdge()) {
    usbMIDI.sendNoteOn(61+oct, 99, channel);  // 61 = C#4
  }
  if (button2.fallingEdge()) {
    usbMIDI.sendNoteOn(62+oct, 99, channel);  // 62 = D4
  }
  if (button3.fallingEdge()) {
    usbMIDI.sendNoteOn(63+oct, 99, channel);  // 63 = D#4
  }
  if (button4.fallingEdge()) {
    usbMIDI.sendNoteOn(64+oct, 99, channel);  // 64 = E4
  }
  if (button5.fallingEdge()) {
    usbMIDI.sendNoteOn(65+oct, 99, channel);  // 65 = F4
  }
  if (button6.fallingEdge()) {
    usbMIDI.sendNoteOn(66+oct, 99, channel);  // 66 = F#4
  }
  if (button7.fallingEdge()) {
    usbMIDI.sendNoteOn(67+oct, 99, channel);  // 67 = G4
  }
  if (button8.fallingEdge()) {
    usbMIDI.sendNoteOn(68+oct, 99, channel);  // 68 = G#4
  }
  if (button9.fallingEdge()) {
    usbMIDI.sendNoteOn(69+oct, 99, channel);  // 69 = A5
  }
  if (button10.fallingEdge()) {
    usbMIDI.sendNoteOn(70+oct, 99, channel);  // 70 = A#5
  }
  if (button11.fallingEdge()) {
    usbMIDI.sendNoteOn(71+oct, 99, channel);  // 71 = B5
  }
  if (button12.fallingEdge()) {
    usbMIDI.sendNoteOn(72+oct, 99, channel);  // 72 = D5
  }
  if (button13.fallingEdge()) {
    usbMIDI.sendNoteOn(73+oct, 99, channel);  // 73 = D#5
  }
  if (button14.fallingEdge()) {
    usbMIDI.sendNoteOn(74+oct, 99, channel);  // 74 = E4
  }
  if (button15.fallingEdge()) {
    usbMIDI.sendNoteOn(75+oct, 99, channel);  // 75 = F4
  }
  if (button16.fallingEdge()) {
    usbMIDI.sendNoteOn(76+oct, 99, channel);  // 76 = F#4
  }
  if (button17.fallingEdge()) {
    usbMIDI.sendNoteOn(77+oct, 99, channel);  // 77 = G4
  }
  if (button18.fallingEdge()) {
    usbMIDI.sendNoteOn(78+oct, 99, channel);  // 78 = G#4
  }
  if (button19.fallingEdge()) {
    usbMIDI.sendNoteOn(79+oct, 99, channel);  // 79 = A5
  }
  if (button20.fallingEdge()) {
    usbMIDI.sendNoteOn(80+oct, 99, channel);  // 80 = A#5
  }
  if (button21.fallingEdge()) {
    usbMIDI.sendNoteOn(81+oct, 99, channel);  // 81 = B5
  }
  if (button22.fallingEdge()) {
  usbMIDI.sendNoteOn(82+oct, 99, channel);  // 82 = C5
  }
  if (button23.fallingEdge()) {
  usbMIDI.sendNoteOn(83+oct, 99, channel);  // 83 = C#5
  }
 
  // Octave up/down buttons handler
 
  if (button24.fallingEdge())
  { //up an octave button
   
    if(oct<48){
      oct+=12;}
 
    if(digitalRead(25)==0){
      oct=0;
      for (int i =1;i<132;i++){
        usbMIDI.sendNoteOff(i, 0, channel);
      }
      } //if both buttons, reset octaves and sound
  }
 
  if (button25.fallingEdge()) { //down an octave button
  if(oct>-48){
    oct-=12;
    }
  }
 
  // Check each button for "rising" edge
  // Send a MIDI Note Off message when each button releases
  // For many types of projects, you only care when the button
  // is pressed and the release isn't needed.
  // rising = low (pressed - button connects pin to ground)
  //          to high (not pressed - voltage from pullup resistor)
  if (button0.risingEdge()) {
    usbMIDI.sendNoteOff(60+oct, 0, channel);  // 60 = C4
  }
  if (button1.risingEdge()) {
    usbMIDI.sendNoteOff(61+oct, 0, channel);  // 61 = C#4
  }
  if (button2.risingEdge()) {
    usbMIDI.sendNoteOff(62+oct, 0, channel);  // 62 = D4
  }
  if (button3.risingEdge()) {
    usbMIDI.sendNoteOff(63+oct, 0, channel);  // 63 = D#4
  }
  if (button4.risingEdge()) {
    usbMIDI.sendNoteOff(64+oct, 0, channel);  // 64 = E4
  }
  if (button5.risingEdge()) {
    usbMIDI.sendNoteOff(65+oct, 0, channel);  // 65 = F4
  }
  if (button6.risingEdge()) {
    usbMIDI.sendNoteOff(66+oct, 0, channel);  // 66 = F#4
  }
  if (button7.risingEdge()) {
    usbMIDI.sendNoteOff(67+oct, 0, channel);  // 67 = G4
  }
  if (button8.risingEdge()) {
    usbMIDI.sendNoteOff(68+oct, 0, channel);  // 68 = G#4
  }
  if (button9.risingEdge()) {
    usbMIDI.sendNoteOff(69+oct, 0, channel);  // 69 = A5
  }
  if (button10.risingEdge()) {
    usbMIDI.sendNoteOff(70+oct, 0, channel);  // 70 = A#5
  }
  if (button11.risingEdge()) {
    usbMIDI.sendNoteOff(71+oct, 0, channel);  // 71 = B5
  }
  if (button12.risingEdge()) {
    usbMIDI.sendNoteOff(72+oct, 99, channel);  // 72 = D4
  }
  if (button13.risingEdge()) {
    usbMIDI.sendNoteOff(73+oct, 99, channel);  // 73 = D#4
  }
  if (button14.risingEdge()) {
    usbMIDI.sendNoteOff(74+oct, 99, channel);  // 74 = E4
  }
  if (button15.risingEdge()) {
    usbMIDI.sendNoteOff(75+oct, 99, channel);  // 75 = F4
  }
  if (button16.risingEdge()) {
    usbMIDI.sendNoteOff(76+oct, 99, channel);  // 76 = F#4
  }
  if (button17.risingEdge()) {
    usbMIDI.sendNoteOff(77+oct, 99, channel);  // 77 = G4
  }
  if (button18.risingEdge()) {
    usbMIDI.sendNoteOff(78+oct, 99, channel);  // 78 = G#4
  }
  if (button19.risingEdge()) {
    usbMIDI.sendNoteOff(79+oct, 99, channel);  // 79 = A5
  }
  if (button20.risingEdge()) {
    usbMIDI.sendNoteOff(80+oct, 99, channel);  // 80 = A#5
  }
  if (button21.risingEdge()) {
    usbMIDI.sendNoteOff(81+oct, 99, channel);  // 81 = B5
  }
  if (button22.risingEdge()) {
    usbMIDI.sendNoteOff(82+oct, 99, channel);  // 82 = C4
  }
  if (button23.risingEdge()) {
    usbMIDI.sendNoteOff(83+oct, 99, channel);  // 83 = C#4
  }
  // MIDI Controllers should discard incoming MIDI messages.
  // http://forum.pjrc.com/threads/24179-Teensy-3-Ableton-Analog-CC-causes-midi-crash
  while (usbMIDI.read()) {
    // ignore incoming messages
  }
}

Wednesday, April 5, 2017

Unix - Flatten a directory while preserving filenames and adding folder name



the_top_directory_you_want_to_do_this_from$ paste OLD NEW|while read OLD NEW;do mv ${OLD} ${NEW};done

Now remove empty subdirectories:

the_top_directory_you_want_to_do_this_from$ find */ -depth -type d -exec echo rmdir '{}' \; 





R code - Quick Kaplan-Meier

This give a nice Kaplan-Meier with graphically illustrated confidence intervals

Fire up the relevant packages in R:

> install.packages('survminer')
> library(survminer)
> library(survival)

Then go to excel and make and copy to clipboard a table of this format:

times
censor
therapy
111
0
Drug1
88
1
Drug2
221
1
Drug1
49
1
Drug2
303
0
Drug1
44
1
Drug2
602
1
Drug1
79
1
Drug2

(censor is 0 for right censored, 1 for event)

Then paste the data into an R data frame:

If mac:
> dat4km<-read.table(pipe("pbpaste"),sep="\t",header=T)

If PC:

>dat4km <- read.table(file = "clipboard", sep = "t", header=TRUE)


then create the survival model and plot it:

> fit4km<-(survfit(Surv(times,censor)~therapy, data=dat4km))

> ggsurvplot(fit4km, risk.table = TRUE,pval=TRUE, conf.int=TRUE)

Gadgets - an egg timer




This little beast was a long time in the thinking, and finally got done a few weekends ago. I wanted an egg timer that would be activated by a single press (there is a switch behind the plate with the 6 LEDs); would have an increment increased with the same single button; would remember what it was last set at; and (very important) have minimal power consumption without a dedicated on-off switch. The latter is achieved, as I found with several experiments, very effectively, by lowering the clock frequency of the chip, giving a calculated AA battery life due to the quiescent current of no less than 5 years. Lastly I wanted to put this object into a case where the button was somehow incorporated into the object - and I wanted to 3D print the object, which gave me latitude for unusual shapes. The components are minimalist. The egg timer counts up to six minutes because I wanted to use an O8M2 chip; the 6 LEDs are multiplexed by reversing the polarity. The voltage is important. At 4.5 V results were bizarre because 4.5 exceeds the voltage drop of two red LEDs. 4.5V would be fine for blue LEDs. 




The commented code is below. Times were worked out empirically and are accurate to within a couple of seconds. The main loop is simply a 5 second pause at 31KHz. This is preferable to nap because response to an interrupt, waking the timer, is instantaneous. Upon wake the clock frequency is increased to 4 MHz. Single clicks of the switch (by pushing on the face with the six LEDs) increment the time interval with the number of lit LEDs indicating the time. If the device is then left unclicked for a few seconds, countdown begins from the indicated number of minutes. The LEDs flash to indicate the remaining time on the clock; at the end of the time the device flashes and beeps pleasantly, and then returns to low clock frequency sleep mode. The device can be interrupted during the countdown or the alarm, with another single click.

EEPROM 0,(3)
init:
disableBOD
pinsC=000000
setint 001000,001000
setfreq k31

main:
pause 5000
goto main

interrupt:
setfreq m4
let dirsC=%11110111

settime:

'clicks start at an initial default of 3 min, go up to six and back around to 1
'after the first time use the last value stored in eeprom
read 0, b4
select case b4
case 1
  goto onestart
case 2
  goto twostart
case 3
  goto threesstart
case 4
  goto fourstart
case 5
  goto fivestart
case 6
  goto sixesstart
endselect

threesstart:
if pinC.3=1 then threesstart
b10=0
b1=3

threes:
gosub three
if pinC.3=1 then fourstart
b10=b10+1
if b10>40 then goto countdown3
goto threes

fourstart:
if pinC.3=1 then fourstart
b10=0
b1=4

fours:
gosub four
if pinC.3=1 then fivestart
b10=b10+1
if b10>40 then goto countdown4
goto fours

fivestart:
if pinC.3=1 then fivestart
b10=0
b1=5

fives:
gosub five
if pinC.3=1 then sixesstart
b10=b10+1
if b10>40 then goto countdown5
goto fives

sixesstart:
if pinC.3=1 then sixesstart
b10=0
b1=6

sixes:
gosub six
if pinC.3=1 then onestart
b10=b10+1
if b10>40 then goto countdown6
goto sixes

onestart:
if pinC.3=1 then onestart
b10=0
b1=1

ones:
gosub one
if pinC.3=1 then twostart
b10=b10+1
if b10>40 then goto countdown1
goto ones

twostart:
if pinC.3=1 then twostart
b10=0
b1=2

twos:
gosub two
if pinC.3=1 then threesstart
b10=b10+1
if b10>40 then goto countdown2
goto twos

countdown6:
if b1 !=b4 then write 0,b1
endif
pinsC=000000
for b3=0 to 29
pause 1970
if pinC.3=1 then backtobed
gosub six
next b3

countdown5:
if b1 !=b4 then write 0,b1
endif
pinsC=000000
for b3=0 to 29
pause 1970
if pinC.3=1 then backtobed
gosub five
next b3

countdown4:
if b1 !=b4 then write 0,b1
endif
pinsC=000000
for b3=0 to 29
pause 1970
if pinC.3=1 then backtobed
gosub four
next b3

countdown3:
if b1 !=b4 then write 0,b1
endif
pinsC=000000
for b3=0 to 29
pause 1970
if pinC.3=1 then backtobed
gosub three
next b3

countdown2:
if b1 !=b4 then write 0,b1
endif
pinsC=000000
for b3=0 to 29
pause 1970
if pinC.3=1 then backtobed
gosub two
next b3

countdown1:
if b1 !=b4 then write 0,b1
endif
pinsC=000000
for b3=0 to 58
pause 970
if pinC.3=1 then backtobed
gosub one
next b3

alarm:
for b3=0 to 50
tune C.2, 1,($00,$03, $05)
pinsC=000111
if pinC.3=1 then backtobed
tune C.2, 1,($07,$09, $11)
pinsC=010000
if pinC.3=1 then backtobed
next b3

backtobed:
pinsC=010000
if pinC.3=1 then backtobed
setint 001000,001000
setfreq k31
pinsC=000000
return

'at k31, disablebod
'pause 5000 this config gives 3mv across a 200ohm inline supply resistor
'nap 4 gives 2.8 mv
'at m4 , disablebod
'nap 4 gives 2.8 mv
'pause 5000 gives 110mv!!
'at m4 , enablebod
'nap 4 gives 4.8 mv
'pause 5000 gives 110mv!!
'at k31 , enablebod
'nap 4 gives 3.8 mv
'pause 5000 gives 4 mv

six:
let pinsC=00000001
pause 5
let pinsC=00010110
pause 5
let pinsC=00000010
pause 5
let pinsC=00010101
pause 5
let pinsC=00000100
pause 5
let pinsC=00010011
pause 5
let pinsC=00000000
return

five:
let pinsC=00000000
pause 5
let pinsC=00010110
pause 5
let pinsC=00000010
pause 5
let pinsC=00010101
pause 5
let pinsC=00000100
pause 5
let pinsC=00010011
pause 5
let pinsC=00000000
return

four:
let pinsC=00000000
pause 5
let pinsC=00000000
pause 5
let pinsC=00000010
pause 5
let pinsC=00010101
pause 5
let pinsC=00000100
pause 5
let pinsC=00010011
pause 5
let pinsC=00000000
return

three:
let pinsC=00000000
pause 5
let pinsC=00000000
pause 5
let pinsC=00000000
pause 5
let pinsC=00010101
pause 5
let pinsC=00000100
pause 5
let pinsC=00010011
pause 5
let pinsC=00000000
return

two:
let pinsC=00000000
pause 5
let pinsC=00000000
pause 5
let pinsC=00000000
pause 5
let pinsC=00000000
pause 5
let pinsC=00000100
pause 5
let pinsC=00010011
pause 5
let pinsC=00000000
return

one:
let pinsC=00000000
pause 5
let pinsC=00000000
pause 5
let pinsC=00000000
pause 5
let pinsC=00000000
pause 5
let pinsC=00000000
pause 5
let pinsC=00010011
pause 5
let pinsC=00000000
return