supercolliderArduino_sendAndReceive

clean-up: #33

below is some supercollider code for sending and receiving data from an arduino. it is a good example i think and worth sharing. it can be used as a template for when you want to read and write at the same time.

as the example is written supercollider writes data to six pwm channels (0-255), and reads data from six analog inputs (also 0-255). the sliders are the pwm output controllers, and the sensor input data is just posted as an array.

//supercolliderArduino_sendAndReceive /f0
//  controlling 6 pwm channels and reading 6 analog inputs at the same time
//  use with sc code supercolliderArduino_sendAndReceive.scd

//--serial protocol
// pwm sc->arduino: 10 nn nn nn nn nn nn 11 (nn bytes 1-6= pwm channels 0-5)
// adc arduino->sc: 20 nn nn nn nn nn nn 21 (nn bytes 1-6= analog channels 0-5)

//--settings
byte pwmPins[]= {5, 3, 9, 6, 11, 10};
byte adcPins[]= {0, 1, 2, 3, 4, 5};  //A0-A5

//--variables
boolean changed;
byte val, cnt= 0;
byte pwmData[]= {0, 0, 0, 0, 0, 0, 0, 0};
byte adcData[]= {0, 0, 0, 0, 0, 0, 0, 0};  //for detecting change and filter out repetitions

void setup() {
  Serial.begin(38400);    //baudrate must match in sc
  for(byte i= 0; i<6; i++) {
    pinMode(pwmPins[i], OUTPUT);
    pinMode(adcPins[i], INPUT);
  }
}
void loop() {
 
  //--from sc
  while(Serial.available()) {
    val= Serial.read();
    if(cnt==0) {
      if(val==10) {  //beginning of message found
        cnt= 1;  //start counter
      }
    } else if(cnt<7) {  //between 1 and 6 means message started and that bytes should be saved
      pwmData[cnt-1]= val;  //saving incoming bytes in temporary data array
      cnt++;
    } else {
      if(val==11) {
        for(byte i= 0; i<6; i++) {
          analogWrite(pwmPins[i], pwmData[i]);  //output read message to pwm pins
        }
      } else {
        //serial read error
      }
      cnt= 0;  //reset byte counter
    }
  }
 
  //--to sc
  changed= false;
  for(byte i= 0; i<6; i++) {
    val= analogRead(adcPins[i])>>4;  //scale from 10 to 8 bits
    if(val!=adcData[i]) {
      adcData[i]= val;
      changed= true;
    }
  }
  if(changed) {  //check if any sensor changed
    Serial.write(20);
    Serial.write(adcData[0]);
    Serial.write(adcData[1]);
    Serial.write(adcData[2]);
    Serial.write(adcData[3]);
    Serial.write(adcData[4]);
    Serial.write(adcData[5]);
    Serial.write(21);
  }
  delay(10);  //wait 10 milliseconds
}

//--use with supercolliderArduino_sendAndReceive.ino
//supercollider code for reading 6 analog sensors and sending out to 6 pwm channels

SerialPort.listDevices; //run this and see post window for name of serial device

//--gui code for sending 6 pwm
(
var name= "/dev/tty.usbserial-A101NB76";        //edit to match your serial device
var port= SerialPort(name, 38400, crtscts: true);
var pwm= [10, 0, 0, 0, 0, 0, 0, 11];
var win= Window("pwm", Rect(99, 99, 260, 200), false);
Slider(win, Rect(10, 10, 30, 170)).action_{|view| pwm.put(1, (view.value*255).asInteger); port.putAll(pwm.postln)};
Slider(win, Rect(50, 10, 30, 170)).action_{|view| pwm.put(2, (view.value*255).asInteger); port.putAll(pwm.postln)};
Slider(win, Rect(90, 10, 30, 170)).action_{|view| pwm.put(3, (view.value*255).asInteger); port.putAll(pwm.postln)};
Slider(win, Rect(130, 10, 30, 170)).action_{|view| pwm.put(4, (view.value*255).asInteger); port.putAll(pwm.postln)};
Slider(win, Rect(170, 10, 30, 170)).action_{|view| pwm.put(5, (view.value*255).asInteger); port.putAll(pwm.postln)};
Slider(win, Rect(210, 10, 30, 170)).action_{|view| pwm.put(6, (view.value*255).asInteger); port.putAll(pwm.postln)};
win.front;
CmdPeriod.doOnce({port.putAll([10, 0, 0, 0, 0, 0, 0, 11]); port.close; win.close});
//press cmd+. to stop and close window and serial port

s.waitForBoot{
        var byte, num= 6, index= 0, data= Array.newClear(num);
        Ndef(\arduino, {|data= #[0, 0, 0, 0, 0, 0]| Splay.ar(SinOsc.ar(data.lag(0.02)+500, 0, 0.4))}).play; //temp sound
        Routine.run({
                inf.do{
                        while({byte= port.read; byte.notNil}, {
                                //byte.postln;  //debug
                                if(index==0 and:{byte==20}, {//check if first byte is 20
                                        index= 1;
                                        }, {
                                                if(index>=1 and:{index<(num+1)}, {//ok, now start collecting bytes
                                                        data[index-1]= byte;
                                                        index= index+1;
                                                        }, {
                                                                if(index==(num+1) and:{byte==21}, {//until last data byte
                                                                        data.postln;    //debug
                                                                        Ndef(\arduino).setn(\data, data);
                                                                        index= 0;//done. reset index to prepare for new message
                                                                        }, {
                                                                                //something broke or beginning - restart
                                                                                "restart".postln;       //debug
                                                                                index= 0;
                                                                });
                                                });
                                });
                        });
                };
        });
};

)

i also attached the complete example as a zip file.

sc2 nostalgia

clean-up #32:

supercollider 2 (sc2) was such a great piece of software. thank you James McCartney. i plan to go back one day and i already have two old mac ti-books that still boot os9 natively. i also have a lot of patches for max/nato that i still think produces great graphics/video under os9 - so that’s another reason for ’downgrading’.

below is one of my first posts to sc-users. i gathered some courage and sent this mail in aug 2001.
(here is the full thread.) if you play the below sound in the newer supercollider versions it doesn’t sound nearly as good (in my ears). to get a few steps closer to that sc2 sound, try replacing the RHPF with GlitchRHPF from sc3-plugins. still it isn’t the same. listen to the attached mp3 recorded with sc2 to hear these five lines of code go wild in sc2.

------------------------------

Date: Thu, 16 Aug 2001 21:12:27 +0200
From: Fredrik Olofsson <---@---.--->
Subject: noisy instr.

hello

this works... (sc 2.2.11)

({
        RHPF.ar(
                BrownNoise.ar([1,1]),
                LFSaw.ar(1,0.99,2),
                0.24).clip2(0.5)
}.scope
)

this doesn't...

({
        RHPF.ar(
                BrownNoise.ar([1,1]),
                LFSaw.ar(1,0.99,1),             //note add difference
                0.24).clip2(0.5)
}.scope
)

how come the latter example runs fine for about 40 seconds and then
both channels 'get stuck' at +1, one after the other?  i've had the
former playing for at least 9 min.

confused/fredrik

AttachmentSize
Audio icon noisy_instr_ex.mp3629.5 KB

nato to jitter bridge object - for peace and understanding

clean-up #31:

31jan 2003 i released two max objects that could convert video from jitter to nato and back. jitter is the official library for doing video and graphics in max/msp. but before that was nato, or more precisely Nato.0+55+3d. nato was a totally amazing piece of software and with it you could do similar things as with jitter. it was mac os9 only but super poetic and unique in all kinds of ways. i used it a lot for my live video works (klipp av tours, vj-ing etc) and played my last gig using it as late as 2007 (at club maria in berlin). i still miss playing with it.

the binary osc9 objects themselves have been available for download since 2003 from here, but i never released the c source code.
as i wasn't so good with c back then, it took weeks for me to reverse engineer the nato video format. lots of trial-and-error using metrowerks codewarrior.

releasing the objects to the public was scary. i risked loosing my software license. n.n., the author of nato, was notorious for humiliating and threatening nato users online. and even terminating licenses if one said the wrong thing in public. one of the replies i got after the release was "!m go!ng 2 eat u". see http://www.bek.no/pipermail/55/2003-March.txt. and another one was this. luckily my license didn't stop working.

AttachmentSize
File f0.jit2n2.c6.38 KB
File f0.n22jit.c7.79 KB

redUniform2

for an upcoming performance i've revisited the electronics for my redUniform piece. my old setup used a nordic nRF24L01 wireless chip but now i changed to wifi and the adafruit cc3000 module.

the circuit is really minimal and simple. basically it's just the cc3000 wifi module, an atmega328, a 16Mhz chrystal, an on/off switch, one 1000mAh Li-ion and last two 6p connectors for the sensors.

the sensors are two modified minIMU-9.


with the battery fully charged i had it sending osc data at 50hz for more than a whole day.

attached are schematics and arduino code for reading sensors via spi. the code also show how to talk to the cc3000 and send sensor data via osc.
there are also two classes for supercollider called RedUniform2 and RedUniform2GUI.

more processing tweets

three new processing tweets...

//--0021

int s=900,i;void setup(){size(1200,s);strokeWeight(99);}void draw(){stroke(9,9);ellipse(i++%1200,millis()%750+99,i%s/350.,(20+i)%99);}// #p5

//--0022

int j,i;void setup(){size(1024,768);}void draw(){translate(512,384);i=frameCount;while(i-->1){rect(j++%i,j%i,3,i/9%9);rotate(0.009);}}// #p5

//--0023

float j=433,i=9e3;size(1024,768,P3D);fill(9,99);beginShape();while(i>0){vertex(sin(i--/99)*j+j,sin(i/j/8)*j*2,cos(i*2)*j);}endShape();// #p5

p50021
p50022
p50023

and more previously

redAlertLight

for a new piece i'm working on (redAlert) i wanted hundreds of red leds attached to special 'blobs' or lamps spread out on stage (designed by Jenny Michel). each led should be able to be freely placed and controlled individually and they had to be fairly bright. and because of the custom led placement i couldn't have used led strips - strips have a fixed distance between the leds.

so i built three circuits that could drive 32 pwm channels each and thereby got 96 pwm channels in total. each channel connects three leds in series (in a single package) and a resistor. that makes in total 288 leds.

the led i selected was the LED 5252 uh rt/1700mcd. it has 120 degrees spread angle and comes in a 5x5mm 6pin smd package that's possible to solder by hand. i bought it from segor where it costs 0.42 euro if you buy +100.

here a picture of it from the back side. the 270ohm resistor is chosen to match 12v and the three leds are connected in series using thin copper wire.

redAlertLight01

the three boards are controlled wirelessly and i send osc commands from supercollider to control all the leds. there's a class for supercollider attached below that helps with addressing and packaging of the network data. one can build and connect as many of these 32ch boards as one likes.

for actually generating the 12v pwm i used on each board two tlc5490 in combination with four uln2803a. and i also added a barebone arduino to get a stable spi communication with the tlc5490.

redAlertLight00

back side...
redAlertLight02

for receiving wireless osc data i added a raspberry pi (model a) with an usb wlan stick. on the rpi there's just a small python program that receives osc and sends out serial commands to the arduino.

last i have a tp-link TL-WR703N with open wrt installed acting as a router. when the boards start up they try to connect to this router and gets an ip assigned dynamically. this ip i use in supercollider to differentiate between the three boards.

installation instructions

//--
* put 2013-09-25-wheezy-raspbian.img on a sd-card with Pi Filler
* put the card in a raspberry pi MODEL B, connect ethernet and 5v
* find the IP with LanScan.app

(* ssh-keygen -R 192.168.1.51)
* ssh pi@192.168.1.51
* default password: raspberry
* sudo raspi-config
* select 'Expand Filesystem', change password, reboot and log in with ssh again

* sudo apt-get update
* sudo apt-get upgrade
* sudo pico /etc/inittab
* comment out the line 'T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100' near the bottom and save
* sudo pico /boot/cmdline.txt
* remove 'console=ttyAMA0,115200 kgdboc=ttyAMA0,115200' and save
* sudo reboot

* sudo apt-get install python-serial
* git clone git://gitorious.org/pyosc/devel.git
* cd devel
* sudo ./setup.py install
* cd ~

//--set up wlan on the rpi
* sudo nano /etc/network/interfaces
* edit to say...
        auto wlan0
        allow-hotplug wlan0
        iface wlan0 inet dhcp
                wpa-ssid SSID_NAME
                wpa-psk SSID_PASS
                wireless-power off
* sudo ifdown wlan0
* sudo ifup wlan0

//--copy file from laptop to rpi
* scp redAlertLight.py pi@192.168.1.51:/home/pi/

//--automatically start the python program at startup
* sudo pico /etc/rc.local
* add the following before the exit line: (sleep 1; python /home/pi/redAlertLight.py) & # autostart

//now move the sd card over to model a, connect the circuit and try

//--useful if you log in via ssh and want to stop the python program
* sudo pkill python

here is the python code...

#redFrik 2013

import serial
import socket
import OSC
import threading
import time
import os

addy= '0.0.0.0', 15000  #from sc
osc_server= OSC.OSCServer(addy)

port= serial.Serial('/dev/ttyAMA0', 115200)     #to atmega168
port.open()

def osc_led(addr, tags, data, source):
        #print tags
        #print "incoming osc data: %s" % data
        arr= bytearray()
        arr.append(254)
        for val in data:        #data has size 16 (24bit ints)
                hi_val= val>>12
                lo_val= val&4095
                #here can be optimized later to send fewer bytes (48 instead of 64)
                arr.append(hi_val>>8)
                arr.append(hi_val&255)
                arr.append(lo_val>>8)
                arr.append(lo_val&255)
        arr.append(255)
        port.write(arr)

osc_server.addMsgHandler("/led", osc_led)

def osc_stop(addr, tags, data, source):
        #print tags
        #print "shutting down"
        shutdown()

osc_server.addMsgHandler("/stop", osc_stop)

thread= threading.Thread(target= osc_server.serve_forever)
thread.start()

def all_led_off():
        osc_led(None, None, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], None)

def shutdown():
        close()
        os.system("sudo halt")
        exit()

def close():
        print "\nclosing"
        osc_server.close()
        all_led_off()
        port.close()
        #thread.join()

def main():
        try:
                while True:
                        line= port.readline()
                        if line.startswith("stop"):
                                shutdown()
        except KeyboardInterrupt:
                close()

if __name__ == "__main__":
        main()

attached is schematics, arduino firmware, partslist...

AttachmentSize
Image icon redAlertLight_schem.png1.5 MB
Package icon redAlert_mega168.zip1.1 KB
Plain text icon partlist.txt533 bytes
Package icon RedAlertLight.zip7.58 KB

redThermoKontroll2

for my upcoming solo at the sound of stockholm festival, i decided to rebuild my main wireless controller. previously it used a nordic nRF24L01+transceiver as radio module, but the range wasn't great and communication often broke down during live performances. i don't know much about these things, but i guess that when the audience bring in mobile phones the radio spectrum quickly fills up.

so i constructed a new circuit from scratch and while i was at it also reworked the resistor ladders and other cabling inside the box. now it's using wifi. the new radio module i installed in the controller box is adafruit's great CC3000 WiFi Breakout, and as receiver i use a small tl-wr703n wifi router running openwrt.
the wireless range is now excellent and everything is a lot more stable. i could also drastically reduce the amount of data being sent by fixing the resistor ladders.

circuit... (basically just one atmega382p, a 16 channel adc, voltage divider resistors and the wifi module)

redThermoKontroll2-00

inside...
redThermoKontroll2-01

outside...
redThermoKontroll2-02

100ohm resistor ladder...

redThermoKontroll2-03

below are parts list, schematics, firmware and a supercollider class.

redThermoKontroll (wifi version) parts list:

1 4067 multiplexer
1 atmega328p
1 16mhz crystal
2 27p
1 socket 2x14 (28pin)
1 adafruit cc3000 module
1 1x9 pin header
1 1x10 pin header
1 1x8 pin header
1 1x5 pin header

1 resettable fuse 1a
1 zener diode 5.6v
1 0.1uF cap
1 100uF electrolytic cap
1 470uF electrolytic cap

10 220, 270, 330, 680, 1k, 2, 10k resistors
1 220 resistor for led

1 power jack
1 ldr
1 red led

lots of 100ohm resistors for resistor ladders

redThermoKontroll-schematics2

//redThermoKontroll2
//redFrik 2013 gnu gpl v2
//updated 150920 - automatically send to IP x.x.x.99 (constructed from given DHCP IP)

//make sure to use Paul Stoffregen's branch of the Adafruit_CC3000 library
//and cc3000 firmware 1.24 (1.11.1)
//select board UNO and upload to a ATMEGA328P chip (using a usbtinyisp programmer)
//test in terminal with command: nc -ul 58100

#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>

#define WLAN_SSID       "xxx"
#define WLAN_PASS       "yyy"
#define WLAN_SECURITY   WLAN_SEC_WPA2

#define PORT            58100
#define DELAY           10
#define PINGRATE        2000

#define ADAFRUIT_CC3000_IRQ   3   //mega328 pin 5
#define ADAFRUIT_CC3000_VBEN  8   //mega328 pin 14
#define ADAFRUIT_CC3000_CS    10  //mega328 pin 16
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBEN, SPI_CLOCK_DIVIDER);
Adafruit_CC3000_Client client;

uint8_t buf[16];
byte last[] = {
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

byte cnt = 0;
unsigned long time;

void setup(void) {
  Serial.begin(115200);  //debug

  //--pins
  pinMode(7, OUTPUT);         //led
  pinMode(6, OUTPUT);         //4067 d (DDD6)
  pinMode(5, OUTPUT);         //4067 c (DDD5)
  pinMode(4, OUTPUT);         //4067 b (DDD4)
  pinMode(2, OUTPUT);         //4067 a (DDD2)
  pinMode(A5, INPUT);         //4067 x
  pinMode(A4, INPUT_PULLUP);  //capa1 (right)
  pinMode(A3, INPUT_PULLUP);  //capa0 (left)
  pinMode(A2, INPUT_PULLUP);  //swiUp (up)
  pinMode(A1, INPUT_PULLUP);  //swiUp (down)
  pinMode(A0, INPUT_PULLUP);  //swiOn

  //--wifi
  flash(1);
  Serial.println(F("Starting"));
  if (!cc3000.begin()) {
    Serial.println(F("Unable to initialise the CC3000! Check your wiring?"));
    while (1);
  }
  flash(2);
  Serial.println(F("\nDeleting old connection profiles"));
  if (!cc3000.deleteProfiles()) {
    Serial.println(F("Failed!"));
    while (1);
  }
  cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY);
  Serial.println(F("Connected!"));
  flash(3);
  Serial.println(F("Request DHCP"));
  while (!cc3000.checkDHCP()) {
    delay(100); // ToDo: Insert a DHCP timeout!
  }
  uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
  while (!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv)) {
    Serial.println(F("Unable to retrieve the IP Address!"));
    delay(100);
  }
  Serial.print(F("\nCC3000 IP Addr: "));
  cc3000.printIPdotsRev(ipAddress);
  //the following sets receiver to x.x.x.99 and assume cc3000 will never get exactly that IP itself
  ipAddress = cc3000.IP2U32(ipAddress >> 24 & 255, ipAddress >> 16 & 255, ipAddress >> 8 & 255, 99);
  Serial.print(F("\nReceiver IP Addr: "));
  cc3000.printIPdotsRev(ipAddress);
  client = cc3000.connectUDP(ipAddress, PORT);

  //--osc message [/tk2, index, value]
  buf[0] = 47;   // /
  buf[1] = 116;  // t
  buf[2] = 107;  // k
  buf[3] = 50;   // 2
  buf[4] = 0;
  buf[5] = 0;
  buf[6] = 0;
  buf[7] = 0;
  buf[8] = 44;   // ,
  buf[9] = 105;  // i
  buf[10] = 0;
  buf[11] = 0;
  buf[12] = 0;   //msb - index
  buf[13] = 0;   //
  buf[14] = 0;   //
  buf[15] = 0;   //lsb - value
}

void loop(void) {
  byte val;

  //--analog inputs
  for (byte i = 0; i < 13; i++) {
    setChan(i);
    delay(1);                //not sure if needed
    val = analogRead(A5) >> 2; //from 10 to 8 bits
    if (val != last[i]) {
      sendOsc(i, val);
      last[i] = val;
    }
  }

  //--digital inputs
  val = PINC & 0b00011111;
  if (val != last[13]) {
    sendOsc(13, val);
    last[13] = val;
  }

  //--ping
  if (millis() - time > PINGRATE) {
    sendOsc(127, 0);      //ping
    time = millis();
  }
}

void sendOsc(byte index, byte val) {
  buf[12] = index;
  buf[15] = val;
  if (cnt++ % 2 == 0) {   //toggle red led
    PORTD &= ~_BV(DDD7);
  }
  else {
    PORTD |= _BV(DDD7);
  }
  client.write(buf, sizeof(buf));
  delay(DELAY);
}

void setChan(byte index) {
  switch (index) {
    case 0:
      PORTD &= ~_BV(DDD2);                                      //low
      PORTD &= ~_BV(DDD4);                                      //low
      PORTD &= ~_BV(DDD5);                                      //low
      PORTD &= ~_BV(DDD6);                                      //low
      break;
    case 1:
      PORTD |= _BV(DDD2);                                               //high
      PORTD &= ~_BV(DDD4);                                      //low
      PORTD &= ~_BV(DDD5);                                      //low
      PORTD &= ~_BV(DDD6);                                      //low
      break;
    case 2:
      PORTD &= ~_BV(DDD2);                                      //low
      PORTD |= _BV(DDD4);                                               //high
      PORTD &= ~_BV(DDD5);                                      //low
      PORTD &= ~_BV(DDD6);                                      //low
      break;
    case 3:
      PORTD |= _BV(DDD2);                                               //high
      PORTD |= _BV(DDD4);                                               //high
      PORTD &= ~_BV(DDD5);                                      //low
      PORTD &= ~_BV(DDD6);                                      //low
      break;
    case 4:
      PORTD &= ~_BV(DDD2);                                      //low
      PORTD &= ~_BV(DDD4);                                      //low
      PORTD |= _BV(DDD5);                                               //high
      PORTD &= ~_BV(DDD6);                                      //low
      break;
    case 5:
      PORTD |= _BV(DDD2);                                               //high
      PORTD &= ~_BV(DDD4);                                      //low
      PORTD |= _BV(DDD5);                                               //high
      PORTD &= ~_BV(DDD6);                                      //low
      break;
    case 6:
      PORTD &= ~_BV(DDD2);                                      //low
      PORTD |= _BV(DDD4);                                               //high
      PORTD |= _BV(DDD5);                                               //high
      PORTD &= ~_BV(DDD6);                                      //low
      break;
    case 7:
      PORTD |= _BV(DDD2);                                               //high
      PORTD |= _BV(DDD4);                                               //high
      PORTD |= _BV(DDD5);                                               //high
      PORTD &= ~_BV(DDD6);                                      //low
      break;
    case 8:
      PORTD &= ~_BV(DDD2);                                      //low
      PORTD &= ~_BV(DDD4);                                      //low
      PORTD &= ~_BV(DDD5);                                      //low
      PORTD |= _BV(DDD6);                                               //high
      break;
    case 9:
      PORTD |= _BV(DDD2);                                               //high
      PORTD &= ~_BV(DDD4);                                      //low
      PORTD &= ~_BV(DDD5);                                      //low
      PORTD |= _BV(DDD6);                                               //high
      break;
    case 10:
      PORTD &= ~_BV(DDD2);                                      //low
      PORTD |= _BV(DDD4);                                               //high
      PORTD &= ~_BV(DDD5);                                      //low
      PORTD |= _BV(DDD6);                                               //high
      break;
    case 11:
      PORTD |= _BV(DDD2);                                               //high
      PORTD |= _BV(DDD4);                                               //high
      PORTD &= ~_BV(DDD5);                                      //low
      PORTD |= _BV(DDD6);                                               //high
      break;
    case 12:
      PORTD &= ~_BV(DDD2);                                      //low
      PORTD &= ~_BV(DDD4);                                      //low
      PORTD |= _BV(DDD5);                                               //high
      PORTD |= _BV(DDD6);                                               //high
      break;
  }
}
void flash(int num) {
  for(byte i= 0; i<num; i++) {
    digitalWrite(7, HIGH);
    delay(100);
    digitalWrite(7, LOW);
    delay(100);
  }
}

AttachmentSize
Package icon redThermoKontroll2-supercollider.zip8.59 KB

Pages

Subscribe to f0blog RSS