init
This commit is contained in:
commit
633af1071f
16 changed files with 6118 additions and 0 deletions
BIN
Rain1.wav
Executable file
BIN
Rain1.wav
Executable file
Binary file not shown.
45
_archive.ringringrain_2011/_instruction.txt
Normal file
45
_archive.ringringrain_2011/_instruction.txt
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
Instruction
|
||||||
|
([xx] referring sections in 'Useful Notes')
|
||||||
|
-
|
||||||
|
1) building image / set-up ssh. & x11
|
||||||
|
-> [a0]
|
||||||
|
-> [a1: verify ccrma img.]
|
||||||
|
-> dd image. (8GB Trenscend class 10 microsdhc had been used.) / use rdisk if you are using mac. damn faster. (but, better not use mac for that 5 min.)
|
||||||
|
-> go get XQuartz, for OSX Lion.
|
||||||
|
-> [a3: mac's ssh check]
|
||||||
|
|
||||||
|
2)
|
||||||
|
-> ssh into RPi - ssh -XY ccrma@192.168.105.106 (through Ethernet, this ip is fixed one. mac's ethernet should be manually set as 192.168.105.105/24)
|
||||||
|
-> [a8]
|
||||||
|
-> reboot - sudo shutdown -r now (default pw: temppwd)
|
||||||
|
-> cd /sys/class/sound and look around.. card0 should be identified as your USB interface.. / [b08], [b13]
|
||||||
|
-> [b02: upload files into RPi]
|
||||||
|
-> pd & - to edit things.. and test sound.. etc.
|
||||||
|
-> arduino & - edit firmata code. and re-fuse arduino.
|
||||||
|
-> don't try to do heavy monitoring. gui overload is really significant.. / use very slow monitoring in GUI mode and change the freq. back with text editor (like, nano)
|
||||||
|
-> pd -nogui XXXX &
|
||||||
|
-> be warned with [b16] / it really matters.
|
||||||
|
-> if it works fine. you can check stream type (for example, S16_LE, 44.1kHz sth..) / [b14]
|
||||||
|
-> finally, [b15]
|
||||||
|
-> and reboot. and give it a long run test.
|
||||||
|
-> that's it. done. clap.
|
||||||
|
|
||||||
|
|
||||||
|
Useful Notes (ToC) -> useful_notes.txt
|
||||||
|
-
|
||||||
|
a0 Powering the RPi
|
||||||
|
a1 Verify if the the hash key is the same (optional), in the terminal run:
|
||||||
|
a3 locale problem of ssh
|
||||||
|
a4 finding raspberry's ip! --> arp -a
|
||||||
|
a8 assigning UX1-EA (usb audio dev.) as a default dev.
|
||||||
|
-
|
||||||
|
b01 fsck for raspberry pi
|
||||||
|
b02 Using scp to transfer files in Linux
|
||||||
|
b03 blocked RPi
|
||||||
|
b08 identifying sound card (ex. hw:0,1)
|
||||||
|
b09 setting file for pd
|
||||||
|
b10 make a backup of image
|
||||||
|
b13 identifying the cards.. (for jack..)
|
||||||
|
b14 where to find current stream info!
|
||||||
|
b15 starting automatically pd patch.
|
||||||
|
b16 don't use loadbang -> pd dsp 1; when you do pd with nogui-mode on RPi). NEVER!
|
||||||
344
_archive.ringringrain_2011/_useful_notes.txt
Normal file
344
_archive.ringringrain_2011/_useful_notes.txt
Normal file
|
|
@ -0,0 +1,344 @@
|
||||||
|
Useful Notes
|
||||||
|
|
||||||
|
- ToC Start -
|
||||||
|
a0 Powering the RPi
|
||||||
|
a1 Verify if the the hash key is the same (optional), in the terminal run:
|
||||||
|
a3 locale problem of ssh
|
||||||
|
a4 finding raspberry's ip! --> arp -a
|
||||||
|
a8 assigning UX1-EA (usb audio dev.) as a default dev.
|
||||||
|
-
|
||||||
|
b01 fsck for raspberry pi
|
||||||
|
b02 Using scp to transfer files in Linux
|
||||||
|
b03 blocked RPi
|
||||||
|
b08 identifying sound card (ex. hw:0,1)
|
||||||
|
b09 setting file for pd
|
||||||
|
b10 make a backup of image
|
||||||
|
b13 identifying the cards.. (for jack..)
|
||||||
|
b14 where to find current stream info!
|
||||||
|
b15 starting automatically pd patch.
|
||||||
|
b16 don't use loadbang -> pd dsp 1; on RPi. NEVER!
|
||||||
|
- ToC End -
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-
|
||||||
|
a0 Powering the RPi
|
||||||
|
If you use the micro-USB power input to power the RPi you might encounter sudden reboots when plugging in or unplugging USB devices. If you want to be sure your RPi doesn't reboot in such cases you can try backfeed powering your RPi by connecting the power supply to one of the USB ports or use a powered USB hub that backfeeds. Also make sure your power supply can provide at least 700mA at 5V. If you plan on using an USB interface you might need more power so try to find a power supply that provides 2A or even more.
|
||||||
|
-
|
||||||
|
a1 Verify if the the hash key is the same (optional), in the terminal run:
|
||||||
|
shasum ~/Downloads/2012-12-16-wheezy-raspbian.zip
|
||||||
|
-
|
||||||
|
a3 locale problem of ssh
|
||||||
|
-
|
||||||
|
Q. perl: warning: Setting locale failed.
|
||||||
|
perl: warning: Please check that your locale settings:
|
||||||
|
LANGUAGE = (unset),
|
||||||
|
LC_ALL = (unset),
|
||||||
|
LC_CTYPE = "UTF-8",
|
||||||
|
LANG = "en_GB.UTF-8"
|
||||||
|
are supported and installed on your system.
|
||||||
|
perl: warning: Falling back to the standard locale ("C").
|
||||||
|
locale: Cannot set LC_CTYPE to default locale: No such file or directory
|
||||||
|
locale: Cannot set LC_ALL to default locale: No such file or directory
|
||||||
|
-
|
||||||
|
A.
|
||||||
|
-
|
||||||
|
Does this problem happen if you are using a particular program on the RPi, or is it when you use SSH from another computer?
|
||||||
|
|
||||||
|
If it happens when using SSH, this is a fault on the SSH client, not the RPi. For example using an Ubuntu machine as the SSH client will cause this problem.
|
||||||
|
|
||||||
|
To fix this SSH problem, edit the file /etc/ssh/ssh_config on the SSH client (not the RPi) and remove the line
|
||||||
|
SendEnv LANG LC_*
|
||||||
|
|
||||||
|
This stops the client sending invalid locale information to the RPi.
|
||||||
|
-
|
||||||
|
Thanks bredman, your tip worked for me.
|
||||||
|
In my case, however, the conf file is /etc/ssh_config (ssh client on Mac Mountain Lion, 10.8.2). I commented like this:
|
||||||
|
# SendEnv LANG LC_*
|
||||||
|
and now I can even run python scripts on the raspberry that earlier caused errors like
|
||||||
|
"UnicodeEncodeError: 'ascii' codec can't encode character ..."
|
||||||
|
Great!
|
||||||
|
-
|
||||||
|
a4 finding raspberry's ip! --> arp -a
|
||||||
|
-
|
||||||
|
a8 assigning UX1-EA (usb audio dev.) as a default dev.
|
||||||
|
-
|
||||||
|
How to Assign USB Audio as primary sound device in ALSA
|
||||||
|
-
|
||||||
|
This is for anyone that has a fried sound card (like me) in their laptop. Instead of replacing the motherboard or tossing your old laptop in the trash, get a pair of USB speakers and follow this procedure:
|
||||||
|
(This procedure will get sound going without the need of installing pulse audio)
|
||||||
|
1) Backup the file /etc/modprobe.d/alsa-base.conf
|
||||||
|
Note: Original alsa-base.conf:
|
||||||
|
# autoloader aliases
|
||||||
|
install sound-slot-0 /sbin/modprobe snd-card-0
|
||||||
|
install sound-slot-1 /sbin/modprobe snd-card-1
|
||||||
|
install sound-slot-2 /sbin/modprobe snd-card-2
|
||||||
|
install sound-slot-3 /sbin/modprobe snd-card-3
|
||||||
|
install sound-slot-4 /sbin/modprobe snd-card-4
|
||||||
|
install sound-slot-5 /sbin/modprobe snd-card-5
|
||||||
|
install sound-slot-6 /sbin/modprobe snd-card-6
|
||||||
|
install sound-slot-7 /sbin/modprobe snd-card-7
|
||||||
|
# Cause optional modules to be loaded above generic modules
|
||||||
|
install snd /sbin/modprobe --ignore-install snd && { /sbin/modprobe --quiet snd-ioctl32 ; /sbin/modprobe --quiet snd-seq ; }
|
||||||
|
install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi && { /sbin/modprobe --quiet snd-seq-midi ; : ; }
|
||||||
|
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && { /sbin/modprobe --quiet snd-emu10k1-synth ; : ; }
|
||||||
|
# Prevent abnormal drivers from grabbing index 0
|
||||||
|
options bt87x index=-2
|
||||||
|
options cx88_alsa index=-2
|
||||||
|
options snd-atiixp-modem index=-2
|
||||||
|
options snd-intel8x0m index=-2
|
||||||
|
options snd-via82xx-modem index=-2
|
||||||
|
# Keep snd-pcsp from beeing loaded as first soundcard
|
||||||
|
options snd-pcsp index=-2
|
||||||
|
# Keep snd-usb-audio from beeing loaded as first soundcard
|
||||||
|
options snd-usb-audio index=-2
|
||||||
|
|
||||||
|
Add:
|
||||||
|
# Assign USB Audio as default sound card
|
||||||
|
options snd_usb_audio index=-1
|
||||||
|
|
||||||
|
Delete these last TWO lines in the file:
|
||||||
|
# Keep snd-usb-audio from beeing loaded as first soundcard
|
||||||
|
options snd-usb-audio index=-2
|
||||||
|
|
||||||
|
New file should look like this:
|
||||||
|
# autoloader aliases
|
||||||
|
install sound-slot-0 /sbin/modprobe snd-card-0
|
||||||
|
install sound-slot-1 /sbin/modprobe snd-card-1
|
||||||
|
install sound-slot-2 /sbin/modprobe snd-card-2
|
||||||
|
install sound-slot-3 /sbin/modprobe snd-card-3
|
||||||
|
install sound-slot-4 /sbin/modprobe snd-card-4
|
||||||
|
install sound-slot-5 /sbin/modprobe snd-card-5
|
||||||
|
install sound-slot-6 /sbin/modprobe snd-card-6
|
||||||
|
install sound-slot-7 /sbin/modprobe snd-card-7
|
||||||
|
# Cause optional modules to be loaded above generic modules
|
||||||
|
install snd /sbin/modprobe --ignore-install snd && { /sbin/modprobe --quiet snd-ioctl32 ; /sbin/modprobe --quiet snd-seq ; }
|
||||||
|
install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi && { /sbin/modprobe --quiet snd-seq-midi ; : ; }
|
||||||
|
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && { /sbin/modprobe --quiet snd-emu10k1-synth ; : ; }
|
||||||
|
|
||||||
|
# Assign USB Audio as default sound card
|
||||||
|
options snd_usb_audio index=-1
|
||||||
|
|
||||||
|
# Prevent abnormal drivers from grabbing index 0
|
||||||
|
options bt87x index=-2
|
||||||
|
options cx88_alsa index=-2
|
||||||
|
options snd-atiixp-modem index=-2
|
||||||
|
options snd-intel8x0m index=-2
|
||||||
|
options snd-via82xx-modem index=-2
|
||||||
|
# Keep snd-pcsp from beeing loaded as first soundcard
|
||||||
|
options snd-pcsp index=-2
|
||||||
|
NOTE 1: If a sound card is not found by ALSA... ALSA config will not make USB the default sound card, so this tells method tells ALSA, USB audio is what you want it to use.
|
||||||
|
NOTE 2: PCM still needs to be checked in the Alsa Mixer.
|
||||||
|
NOTE 3: The volume icon will now show up in Tint2 (needs to be unmuted) - reboot may be required.
|
||||||
|
NOTE 4: The spelling of the word "beeing", it's a typo by the original coder.
|
||||||
|
-
|
||||||
|
b01 fsck for raspberry pi
|
||||||
|
|
||||||
|
/dev/mmcblk0p2 is the root file system, so it is not easily unmounted. It could probably be re-mounted as read-only, but a simpler way is to schedule a fsck at the next reboot.
|
||||||
|
|
||||||
|
sudo touch /forcefsck
|
||||||
|
then reboot. Or reboot with
|
||||||
|
|
||||||
|
shutdown -rF now
|
||||||
|
which does the same.
|
||||||
|
-
|
||||||
|
Where are fsck results logged at boot time, after /forcefsck?
|
||||||
|
-
|
||||||
|
pi@raspberrypi /var/log/fsck $ ls -la
|
||||||
|
total 16
|
||||||
|
drwxr-xr-x 2 root root 4096 Feb 9 09:52 .
|
||||||
|
drwxr-xr-x 9 root root 4096 May 16 23:44 ..
|
||||||
|
-rw-r----- 1 root adm 125 May 16 23:44 checkfs
|
||||||
|
-rw-r----- 1 root adm 221 May 16 23:44 checkroot
|
||||||
|
pi@raspberrypi /var/log/fsck $ cat checkroot
|
||||||
|
Log of fsck -C -f -a -t ext4 /dev/mmcblk0p2
|
||||||
|
Thu May 16 23:44:09 2013
|
||||||
|
|
||||||
|
fsck from util-linux 2.20.1
|
||||||
|
/dev/mmcblk0p2: 67102/237568 files (0.2% non-contiguous), 384740/937984 blocks
|
||||||
|
|
||||||
|
Thu May 16 23:44:17 2013
|
||||||
|
----------------
|
||||||
|
pi@raspberrypi /var/log/fsck $ cat checkfs
|
||||||
|
Log of fsck -C -R -A -a -f
|
||||||
|
Thu May 16 23:44:21 2013
|
||||||
|
|
||||||
|
fsck from util-linux 2.20.1
|
||||||
|
|
||||||
|
Thu May 16 23:44:21 2013
|
||||||
|
----------------
|
||||||
|
-
|
||||||
|
b02 Using scp to transfer files in Linux
|
||||||
|
-
|
||||||
|
To copy files from the local system to a remote system:
|
||||||
|
scp file... user@host.domain:path
|
||||||
|
-
|
||||||
|
b03 blocked RPi
|
||||||
|
-
|
||||||
|
The new overclocking functionality seems to have destroyed my RasPi.
|
||||||
|
|
||||||
|
I updated everything in my Debian distro yesterday to try out the new overclocking functionality. Ran raspi_config and selected the "medium" option (900 mHz, 2 volt, etc.)
|
||||||
|
|
||||||
|
The unit ran fine, no hiccups. Just a bit faster. I've had the unit up and running for the better part of 2 weeks now without powering it down, so I left it running overnight at the new speed.
|
||||||
|
|
||||||
|
This morning it appears to be dead. Open SSH sessions to my desktop were dead, unit wasn't pingable, and no HDMI video. Removed power and rebooted. Nothing. It looks like the network traffic lights show activity when powered up, but nothing else is working.
|
||||||
|
|
||||||
|
So now what? Since this seems to have been a "sanctioned" upgrade, is this a warranty issue? Is it warning to others? Did someone not test this stuff properly?
|
||||||
|
-
|
||||||
|
Locked up again, on the very lowest raspi-config overclock setting ("modest"). It continues to require a complete unplugging of everything to get it to reboot.
|
||||||
|
-
|
||||||
|
b08 identifying sound card (ex. hw:0,1)
|
||||||
|
|
||||||
|
Use "aplay -l" to get a list of the devices on your system. The hw:X,Y comes from this mapping of your hardware -- in this case, X is the card number, while Y is the device number.
|
||||||
|
-
|
||||||
|
You might be able to get away with using device aliases instead of the "hw:X,Y" -- this is what the output of "aplay -L" shows. The "something:CARD=FOO,DEV=Y" stuff is the alias, and probably won't change between different device plug-ins
|
||||||
|
-
|
||||||
|
b09 setting file for pd
|
||||||
|
-
|
||||||
|
$ nano /home/derek/.pdsettings
|
||||||
|
|
||||||
|
GNU nano 1.2.4 File: /home/derek/.pdsettings
|
||||||
|
|
||||||
|
audioapi: 5
|
||||||
|
noaudioin: False
|
||||||
|
audioindev1: 0 4
|
||||||
|
noaudioout: False
|
||||||
|
audiooutdev1: 0 4
|
||||||
|
audiobuf: 50
|
||||||
|
rate: 44100
|
||||||
|
nomidiin: False
|
||||||
|
midiindev1: 0
|
||||||
|
nomidiout: False
|
||||||
|
midioutdev1: 0
|
||||||
|
path1: /home/derek/pd/rradical/memento
|
||||||
|
path2: /home/derek/pd/ix_toxy
|
||||||
|
path3: /home/derek/pd/berlin
|
||||||
|
path4: /home/derek/pd/rradical/memento/tutorial
|
||||||
|
path5: /home/derek/workshop_patches
|
||||||
|
path6: /usr/local/lib/pd/doc/5.reference
|
||||||
|
path7: /usr/local/lib/pd/extra/xjimmies
|
||||||
|
npath: 7
|
||||||
|
standardpath: 1
|
||||||
|
verbose: 0
|
||||||
|
loadlib1: pool
|
||||||
|
loadlib2: iemlib1
|
||||||
|
loadlib3: iemlib2
|
||||||
|
loadlib4: iem_mp3
|
||||||
|
loadlib5: iem_t3_lib
|
||||||
|
loadlib6: OSC
|
||||||
|
loadlib7: zexy
|
||||||
|
nloadlib: 7
|
||||||
|
defeatrt: 0
|
||||||
|
flags: -alsamidi -rt
|
||||||
|
-
|
||||||
|
b10 make a backup of image
|
||||||
|
-
|
||||||
|
using ubuntu live cd. boot with trial mode.
|
||||||
|
-
|
||||||
|
sudo fdisk -l
|
||||||
|
sudo dd if=/dev/sda of=./OldHD.img
|
||||||
|
-
|
||||||
|
b13 identifying the cards.. (for jack..)
|
||||||
|
-
|
||||||
|
What is the output of
|
||||||
|
cat /proc/asound/cards
|
||||||
|
with the DAC attached?
|
||||||
|
|
||||||
|
And could you also post the output of
|
||||||
|
sudo lsusb -vvv
|
||||||
|
-
|
||||||
|
b14 where to find current stream info!
|
||||||
|
(how can i check what is current playback setup at the moment of playback)
|
||||||
|
-
|
||||||
|
ccrma@satellite /proc/asound/card0 $ cat stream0
|
||||||
|
EDIROL UA-1EX at usb-bcm2708_usb-1.3, full speed : USB Audio
|
||||||
|
|
||||||
|
Playback:
|
||||||
|
Status: Running
|
||||||
|
Interface = 0
|
||||||
|
Altset = 1
|
||||||
|
Packet Size = 288
|
||||||
|
Momentary freq = 44100 Hz (0x2c.199a)
|
||||||
|
Interface 0
|
||||||
|
Altset 1
|
||||||
|
Format: S24_3LE
|
||||||
|
Channels: 2
|
||||||
|
Endpoint: 1 OUT (ADAPTIVE)
|
||||||
|
Rates: 44100
|
||||||
|
|
||||||
|
Capture:
|
||||||
|
Status: Stop
|
||||||
|
Interface 1
|
||||||
|
Altset 1
|
||||||
|
Format: S24_3LE
|
||||||
|
Channels: 2
|
||||||
|
Endpoint: 2 IN (ASYNC)
|
||||||
|
Rates: 44100
|
||||||
|
-
|
||||||
|
reference
|
||||||
|
-
|
||||||
|
http://guayadeque.org/index.php?p=/discussion/576/correct-switching-between-16bit-and-24bit-usb-audio-playback/p1
|
||||||
|
-
|
||||||
|
b15 starting automatically pd patch.
|
||||||
|
-
|
||||||
|
ccrma@satellite ~/on-startup $ cat load_default_patch
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# This script starts pd with a default patch (please see all the way below)
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Copyright (C) Feb. 2012 Edgar Berdahl for the Satelite CCRMA project
|
||||||
|
#
|
||||||
|
# The above copyright notice including the copyright holders and this
|
||||||
|
# permission notice shall be included in all copies, substantial
|
||||||
|
# portions, or derivatives of the Software and Software portions.
|
||||||
|
#
|
||||||
|
# The end-user documentation included with the redistribution, if any,
|
||||||
|
# must include the following acknowledgment: "This product includes
|
||||||
|
# software developed in the course of the Satellite CCRMA project
|
||||||
|
# (http://ccrma.stanford.edu/satellite/) and its contributors", in the
|
||||||
|
# same place and form as other third-party acknowledgments. In
|
||||||
|
# addition, this acknowledgment must appear in the software itself in
|
||||||
|
# the same form and location as other such third-party acknowledgments.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License version 3 as
|
||||||
|
# published by the Free Software Foundation except subject to the additional
|
||||||
|
# attribution requirements described beneath the copyright notice above.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the modified GNU General Public
|
||||||
|
# License along with this program.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# It is necessary to specify the complete path of the pd patch:
|
||||||
|
#pd -nogui /home/ccrma/on-startup/default-patch.pd
|
||||||
|
pd -nogui /home/ccrma/puredata/paperPerfm2011_B-E_RPi_nogui.pd
|
||||||
|
-
|
||||||
|
b16 don't use loadbang -> pd dsp 1; on RPi. NEVER!
|
||||||
|
-
|
||||||
|
Why Doesn't Audio Work When I Start Pd In -Nogui Mode?
|
||||||
|
When I start Pd from the commandline without the GUI in -nogui mode, it can't connect to the soundcard and no dsp seems to happen?
|
||||||
|
Currently, there is a bug in Pd where starting in -nogui mode causes patches to be run before it connects to a sound card. When running the graphical user interface (GUI), there is a delay as the GUI is being setup before patches are run and this is enough time for the sound to be connected. Basically, if you are turning on dsp with a loadbang like this:
|
||||||
|
[loadbang]
|
||||||
|
|
|
||||||
|
[; pd dsp 1(
|
||||||
|
Pd tries to start dsp, but in -nogui mode, it hasn't yet connected to the sound card and you'll get an error similar to this:
|
||||||
|
snd_pcm_open (input): Device or resource busy
|
||||||
|
snd_pcm_open (output): Device or resource busy
|
||||||
|
If so, you can add a delay before starting the dsp:
|
||||||
|
[loadbang]
|
||||||
|
|
|
||||||
|
[delay 100]
|
||||||
|
|
|
||||||
|
[; pd dsp 1(
|
||||||
|
This should be enough time to mimic the delay taken when the GUI starts and the sound card can be setup before dsp is started.
|
||||||
|
-
|
||||||
|
http://puredata.info/docs/faq/why-doesn-t-audio-work-when-i-start-pd-in-nogui-mode
|
||||||
BIN
_archive.ringringrain_2011/puredata/.DS_Store
vendored
Normal file
BIN
_archive.ringringrain_2011/puredata/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
_archive.ringringrain_2011/puredata/Rain1.wav
Executable file
BIN
_archive.ringringrain_2011/puredata/Rain1.wav
Executable file
Binary file not shown.
13
_archive.ringringrain_2011/puredata/mapping2float-help.pd
Normal file
13
_archive.ringringrain_2011/puredata/mapping2float-help.pd
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#N canvas 0 0 450 300 10;
|
||||||
|
#X obj 46 23 vsl 15 128 0 1 0 0 empty empty empty 0 -9 0 10 -262144
|
||||||
|
-1 -1 0 1;
|
||||||
|
#X floatatom 45 208 5 0 0 0 - - -;
|
||||||
|
#X obj 46 168 mapping2float 20 30;
|
||||||
|
#X text 122 25 convert 0 1 range to whatever float interval;
|
||||||
|
#X floatatom 111 135 5 0 0 0 - - -;
|
||||||
|
#X floatatom 176 135 5 0 0 0 - - -;
|
||||||
|
#X text 230 136 set output range;
|
||||||
|
#X connect 0 0 2 0;
|
||||||
|
#X connect 2 0 1 0;
|
||||||
|
#X connect 4 0 2 1;
|
||||||
|
#X connect 5 0 2 2;
|
||||||
24
_archive.ringringrain_2011/puredata/mapping2float.pd
Normal file
24
_archive.ringringrain_2011/puredata/mapping2float.pd
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#N canvas 796 236 280 351 10;
|
||||||
|
#X obj 32 32 inlet;
|
||||||
|
#X obj 32 273 outlet;
|
||||||
|
#X obj 93 31 inlet;
|
||||||
|
#X obj 148 32 inlet;
|
||||||
|
#X text 113 57 min;
|
||||||
|
#X text 167 51 max;
|
||||||
|
#X obj 93 112 t b f;
|
||||||
|
#X obj 93 164 - \$1;
|
||||||
|
#X obj 93 138 \$2;
|
||||||
|
#X obj 133 81 loadbang;
|
||||||
|
#X obj 32 205 *;
|
||||||
|
#X obj 32 235 + \$1;
|
||||||
|
#X connect 0 0 10 0;
|
||||||
|
#X connect 2 0 6 0;
|
||||||
|
#X connect 2 0 11 1;
|
||||||
|
#X connect 3 0 8 0;
|
||||||
|
#X connect 6 0 8 0;
|
||||||
|
#X connect 6 1 7 1;
|
||||||
|
#X connect 7 0 10 1;
|
||||||
|
#X connect 8 0 7 0;
|
||||||
|
#X connect 9 0 8 0;
|
||||||
|
#X connect 10 0 11 0;
|
||||||
|
#X connect 11 0 1 0;
|
||||||
1149
_archive.ringringrain_2011/puredata/paperPerfm2011_B-E_RPi.pd
Executable file
1149
_archive.ringringrain_2011/puredata/paperPerfm2011_B-E_RPi.pd
Executable file
File diff suppressed because it is too large
Load diff
1011
_archive.ringringrain_2011/puredata/paperPerfm2011_B-E_RPi_nogui.pd
Executable file
1011
_archive.ringringrain_2011/puredata/paperPerfm2011_B-E_RPi_nogui.pd
Executable file
File diff suppressed because it is too large
Load diff
541
_archive.ringringrain_2011/puredata/testtone-nogui.pd
Executable file
541
_archive.ringringrain_2011/puredata/testtone-nogui.pd
Executable file
|
|
@ -0,0 +1,541 @@
|
||||||
|
#N canvas 204 123 494 364 12;
|
||||||
|
#X floatatom 72 273 3 0 0 0 - - -;
|
||||||
|
#X obj 27 221 notein;
|
||||||
|
#X obj 27 247 stripnote;
|
||||||
|
#X floatatom 27 272 3 0 0 0 - - -;
|
||||||
|
#X text 219 234 MIDI OUT;
|
||||||
|
#X text 27 197 MIDI IN;
|
||||||
|
#X floatatom 150 272 3 0 0 0 - - -;
|
||||||
|
#X floatatom 120 271 3 0 0 0 - - -;
|
||||||
|
#X obj 120 246 ctlin;
|
||||||
|
#N canvas 0 22 484 446 midi 0;
|
||||||
|
#X obj 96 65 inlet;
|
||||||
|
#X obj 96 262 noteout;
|
||||||
|
#X floatatom 96 92 0 0 0 0 - - -;
|
||||||
|
#X obj 338 113 loadbang;
|
||||||
|
#X obj 96 184 metro;
|
||||||
|
#X obj 96 236 makenote;
|
||||||
|
#X floatatom 189 166 0 0 0 0 - - -;
|
||||||
|
#X obj 96 210 f;
|
||||||
|
#X floatatom 145 166 0 0 0 0 - - -;
|
||||||
|
#X floatatom 233 166 0 0 0 0 - - -;
|
||||||
|
#X floatatom 276 166 0 0 0 0 - - -;
|
||||||
|
#X msg 338 148 500;
|
||||||
|
#X msg 370 148 60;
|
||||||
|
#X msg 399 148 64;
|
||||||
|
#X msg 427 148 250;
|
||||||
|
#X text 144 145 rate;
|
||||||
|
#X text 187 145 pitch;
|
||||||
|
#X text 232 145 vel;
|
||||||
|
#X text 268 146 length;
|
||||||
|
#X obj 230 257 ctlout 1;
|
||||||
|
#X floatatom 230 228 0 0 0 0 - - -;
|
||||||
|
#X connect 0 0 2 0;
|
||||||
|
#X connect 2 0 4 0;
|
||||||
|
#X connect 3 0 11 0;
|
||||||
|
#X connect 3 0 12 0;
|
||||||
|
#X connect 3 0 13 0;
|
||||||
|
#X connect 3 0 14 0;
|
||||||
|
#X connect 4 0 7 0;
|
||||||
|
#X connect 5 0 1 0;
|
||||||
|
#X connect 5 1 1 1;
|
||||||
|
#X connect 6 0 7 1;
|
||||||
|
#X connect 7 0 5 0;
|
||||||
|
#X connect 8 0 4 1;
|
||||||
|
#X connect 9 0 5 1;
|
||||||
|
#X connect 10 0 5 2;
|
||||||
|
#X connect 11 0 8 0;
|
||||||
|
#X connect 12 0 6 0;
|
||||||
|
#X connect 13 0 9 0;
|
||||||
|
#X connect 14 0 10 0;
|
||||||
|
#X connect 20 0 19 0;
|
||||||
|
#X restore 219 284 pd midi;
|
||||||
|
#X floatatom 178 93 3 0 0 0 - tone-vu1 -;
|
||||||
|
#X floatatom 205 93 3 0 0 0 - tone-vu2 -;
|
||||||
|
#X obj 177 126 tgl 20 0 tone-ch1 tone-ch1 1 5 -8 0 12 -262144 -1 -1
|
||||||
|
1 1;
|
||||||
|
#X obj 202 126 tgl 20 0 tone-ch2 tone-ch2 2 5 -8 0 12 -262144 -1 -1
|
||||||
|
1 1;
|
||||||
|
#X obj 219 258 tgl 20 0 empty empty empty 20 8 0 8 -262144 -1 -1 0
|
||||||
|
1;
|
||||||
|
#X obj 184 192 tgl 15 0 tone-monitor set-tone-monitor monitor-inputs
|
||||||
|
23 8 0 12 -262144 -1 -1 0 1;
|
||||||
|
#X text 40 120 OFF;
|
||||||
|
#N canvas 0 22 524 326 more 0;
|
||||||
|
#X floatatom 42 209 0 0 0 0 - - -;
|
||||||
|
#X obj 42 183 f;
|
||||||
|
#X obj 79 183 + 1;
|
||||||
|
#X obj 42 150 metro 1000;
|
||||||
|
#X obj 42 123 tgl 20 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1
|
||||||
|
;
|
||||||
|
#X text 24 30 this window has various wierd debugging stuff...;
|
||||||
|
#X text 22 74 see if Pd's time;
|
||||||
|
#X text 22 93 measurement works:;
|
||||||
|
#X obj 227 127 adc~;
|
||||||
|
#X obj 226 224 print~;
|
||||||
|
#X obj 235 201 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
|
||||||
|
-1;
|
||||||
|
#X obj 227 152 *~ 1;
|
||||||
|
#X obj 302 138 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
|
||||||
|
1;
|
||||||
|
#X obj 302 158 sel 0 1;
|
||||||
|
#X obj 301 183 1;
|
||||||
|
#X obj 333 185 1000;
|
||||||
|
#X text 226 94 print out literal values from ADC 1;
|
||||||
|
#X text 323 136 optionally multiply by 1000;
|
||||||
|
#X connect 1 0 2 0;
|
||||||
|
#X connect 1 0 0 0;
|
||||||
|
#X connect 2 0 1 1;
|
||||||
|
#X connect 3 0 1 0;
|
||||||
|
#X connect 4 0 3 0;
|
||||||
|
#X connect 8 0 11 0;
|
||||||
|
#X connect 10 0 9 0;
|
||||||
|
#X connect 11 0 9 0;
|
||||||
|
#X connect 12 0 13 0;
|
||||||
|
#X connect 13 0 14 0;
|
||||||
|
#X connect 13 1 15 0;
|
||||||
|
#X connect 14 0 11 1;
|
||||||
|
#X connect 15 0 11 1;
|
||||||
|
#X restore 388 266 pd more;
|
||||||
|
#X obj 343 193 tgl 15 0 tone-hipass tone-hipass-set input-hipass 23
|
||||||
|
8 0 12 -262144 -1 -1 1 1;
|
||||||
|
#X obj 243 126 tgl 20 0 tone-ch3 tone-ch3 3 5 -8 0 12 -262144 -1 -1
|
||||||
|
1 1;
|
||||||
|
#X obj 268 126 tgl 20 0 tone-ch4 tone-ch4 4 5 -8 0 12 -262144 -1 -1
|
||||||
|
1 1;
|
||||||
|
#X obj 309 126 tgl 20 0 tone-ch5 tone-ch5 5 5 -8 0 12 -262144 -1 -1
|
||||||
|
1 1;
|
||||||
|
#X obj 334 126 tgl 20 0 tone-ch6 tone-ch6 6 5 -8 0 12 -262144 -1 -1
|
||||||
|
1 1;
|
||||||
|
#X obj 428 117 bng 15 250 50 0 tone-all empty ALL 20 8 0 12 -262144
|
||||||
|
-1 -1;
|
||||||
|
#X obj 428 138 bng 15 250 50 0 tone-none empty NONE 20 8 0 12 -262144
|
||||||
|
-1 -1;
|
||||||
|
#X floatatom 244 93 3 0 0 0 - tone-vu3 -;
|
||||||
|
#X floatatom 272 93 3 0 0 0 - tone-vu4 -;
|
||||||
|
#X floatatom 310 93 3 0 0 0 - tone-vu5 -;
|
||||||
|
#X floatatom 338 93 3 0 0 0 - tone-vu6 -;
|
||||||
|
#X text 237 73 AUDIO INPUT (RMS dB);
|
||||||
|
#X text 101 88 noise;
|
||||||
|
#X text 100 105 tone;
|
||||||
|
#X obj 84 90 vradio 15 1 0 2 tone-type tone-type-set empty 0 -6 0 8
|
||||||
|
-262144 -1 -1 0;
|
||||||
|
#X obj 22 91 vradio 15 1 0 3 tone-radio tone-radio-set empty 0 -6 0
|
||||||
|
8 -262144 -1 -1 1;
|
||||||
|
#X floatatom 376 93 3 0 0 0 - tone-vu7 -;
|
||||||
|
#X floatatom 404 93 3 0 0 0 - tone-vu8 -;
|
||||||
|
#X obj 375 126 tgl 20 0 tone-ch7 tone-ch7 7 5 -8 0 12 -262144 -1 -1
|
||||||
|
1 1;
|
||||||
|
#X obj 400 126 tgl 20 0 tone-ch8 tone-ch8 8 5 -8 0 12 -262144 -1 -1
|
||||||
|
1 1;
|
||||||
|
#N canvas 321 199 321 422 audio 0;
|
||||||
|
#X obj 25 303 s~ tone-mon;
|
||||||
|
#X obj 25 277 line~;
|
||||||
|
#X obj 25 249 pack 0 50;
|
||||||
|
#X obj 25 223 r tone-monitor;
|
||||||
|
#X obj 28 139 * 5;
|
||||||
|
#X obj 28 164 s tone-hip;
|
||||||
|
#X obj 28 114 r tone-hipass;
|
||||||
|
#N canvas 224 106 548 519 glue+loadbang 0;
|
||||||
|
#X obj 8 20 loadbang;
|
||||||
|
#X obj 175 18 r tone-all;
|
||||||
|
#X obj 285 16 r tone-none;
|
||||||
|
#X msg 175 46 \; tone-ch1 1 \; tone-ch2 1 \; tone-ch3 1 \; tone-ch4
|
||||||
|
1 \; tone-ch5 1 \; tone-ch6 1 \; tone-ch7 1 \; tone-ch8 1;
|
||||||
|
#X msg 285 47 \; tone-ch1 0 \; tone-ch2 0 \; tone-ch3 0 \; tone-ch4
|
||||||
|
0 \; tone-ch5 0 \; tone-ch6 0 \; tone-ch7 0 \; tone-ch8 0;
|
||||||
|
#X msg 34 330 \; pd dsp 1 \; tone-pitch 69 \; tone-radio 1 \; tone-radio-set
|
||||||
|
set 1 \; tone-type 0 \; tone-type-set 0 \; tone-all 1 \; tone-hipass-set
|
||||||
|
set 1 \;;
|
||||||
|
#X obj 8 53 delay 1000;
|
||||||
|
#X obj 8 81 print 1sec;
|
||||||
|
#X obj 19 109 delay 1000;
|
||||||
|
#X obj 33 164 delay 1000;
|
||||||
|
#X obj 40 222 delay 1000;
|
||||||
|
#X obj 19 137 print 2sec;
|
||||||
|
#X obj 33 192 print 3sec;
|
||||||
|
#X obj 40 250 print 4sec;
|
||||||
|
#X obj 121 250 delay 1000;
|
||||||
|
#X obj 121 278 print 5sec;
|
||||||
|
#X connect 0 0 6 0;
|
||||||
|
#X connect 1 0 3 0;
|
||||||
|
#X connect 2 0 4 0;
|
||||||
|
#X connect 6 0 7 0;
|
||||||
|
#X connect 6 0 8 0;
|
||||||
|
#X connect 8 0 11 0;
|
||||||
|
#X connect 8 0 9 0;
|
||||||
|
#X connect 9 0 12 0;
|
||||||
|
#X connect 9 0 10 0;
|
||||||
|
#X connect 10 0 13 0;
|
||||||
|
#X connect 10 0 14 0;
|
||||||
|
#X connect 14 0 15 0;
|
||||||
|
#X connect 14 0 5 0;
|
||||||
|
#X restore 22 332 pd glue+loadbang;
|
||||||
|
#N canvas 207 133 468 559 tone-generator 0;
|
||||||
|
#X obj 22 187 osc~;
|
||||||
|
#X obj 22 81 mtof;
|
||||||
|
#X floatatom 22 58 0 0 0 0 - - -;
|
||||||
|
#X floatatom 22 103 0 0 0 0 - - -;
|
||||||
|
#X obj 22 163 sig~;
|
||||||
|
#X obj 22 33 r tone-pitch;
|
||||||
|
#X obj 119 179 noise~;
|
||||||
|
#X obj 65 249 +~;
|
||||||
|
#X obj 282 140 - 1;
|
||||||
|
#X obj 282 172 * -1;
|
||||||
|
#X obj 191 228 line~;
|
||||||
|
#X obj 281 229 line~;
|
||||||
|
#X obj 22 211 *~;
|
||||||
|
#X obj 119 210 *~;
|
||||||
|
#X msg 191 199 \$1 20;
|
||||||
|
#X msg 281 200 \$1 20;
|
||||||
|
#X floatatom 273 109 0 0 0 0 - - -;
|
||||||
|
#X obj 64 504 *~;
|
||||||
|
#X obj 86 477 line~;
|
||||||
|
#X obj 86 450 pack 0 50;
|
||||||
|
#X floatatom 201 365 0 0 0 0 - - -;
|
||||||
|
#X obj 86 423 dbtorms;
|
||||||
|
#X obj 64 530 s~ tone-osc;
|
||||||
|
#X obj 201 282 r tone-radio;
|
||||||
|
#X obj 201 310 sel 0 1 2;
|
||||||
|
#X msg 270 333 0;
|
||||||
|
#X msg 201 335 80;
|
||||||
|
#X msg 234 335 60;
|
||||||
|
#X obj 273 86 r tone-type;
|
||||||
|
#X obj 89 359 r tone-level;
|
||||||
|
#X obj 178 453 s tone-level-set;
|
||||||
|
#X msg 177 428 set \$1;
|
||||||
|
#X obj 329 452 s tone-radio-set;
|
||||||
|
#X obj 327 369 sel 80 60 0;
|
||||||
|
#X msg 327 394 0;
|
||||||
|
#X msg 360 394 1;
|
||||||
|
#X msg 393 394 2;
|
||||||
|
#X msg 329 426 set \$1;
|
||||||
|
#X msg 423 394 2;
|
||||||
|
#X obj 72 89 s tone-pitch-set;
|
||||||
|
#X msg 72 66 set \$1;
|
||||||
|
#X obj 177 29 r tone-hz;
|
||||||
|
#X msg 75 117 set \$1;
|
||||||
|
#X obj 75 140 s tone-hz-set;
|
||||||
|
#X obj 177 55 ftom;
|
||||||
|
#X connect 0 0 12 0;
|
||||||
|
#X connect 1 0 3 0;
|
||||||
|
#X connect 2 0 1 0;
|
||||||
|
#X connect 2 0 40 0;
|
||||||
|
#X connect 3 0 4 0;
|
||||||
|
#X connect 3 0 42 0;
|
||||||
|
#X connect 4 0 0 0;
|
||||||
|
#X connect 5 0 2 0;
|
||||||
|
#X connect 6 0 13 0;
|
||||||
|
#X connect 7 0 17 0;
|
||||||
|
#X connect 8 0 9 0;
|
||||||
|
#X connect 9 0 15 0;
|
||||||
|
#X connect 10 0 12 1;
|
||||||
|
#X connect 11 0 13 1;
|
||||||
|
#X connect 12 0 7 0;
|
||||||
|
#X connect 13 0 7 1;
|
||||||
|
#X connect 14 0 10 0;
|
||||||
|
#X connect 15 0 11 0;
|
||||||
|
#X connect 16 0 8 0;
|
||||||
|
#X connect 16 0 14 0;
|
||||||
|
#X connect 17 0 22 0;
|
||||||
|
#X connect 18 0 17 1;
|
||||||
|
#X connect 19 0 18 0;
|
||||||
|
#X connect 20 0 21 0;
|
||||||
|
#X connect 20 0 31 0;
|
||||||
|
#X connect 21 0 19 0;
|
||||||
|
#X connect 23 0 24 0;
|
||||||
|
#X connect 24 0 26 0;
|
||||||
|
#X connect 24 1 27 0;
|
||||||
|
#X connect 24 2 25 0;
|
||||||
|
#X connect 25 0 20 0;
|
||||||
|
#X connect 26 0 20 0;
|
||||||
|
#X connect 27 0 20 0;
|
||||||
|
#X connect 28 0 16 0;
|
||||||
|
#X connect 29 0 31 0;
|
||||||
|
#X connect 29 0 21 0;
|
||||||
|
#X connect 31 0 30 0;
|
||||||
|
#X connect 33 0 34 0;
|
||||||
|
#X connect 33 1 35 0;
|
||||||
|
#X connect 33 2 36 0;
|
||||||
|
#X connect 33 3 38 0;
|
||||||
|
#X connect 34 0 37 0;
|
||||||
|
#X connect 35 0 37 0;
|
||||||
|
#X connect 36 0 37 0;
|
||||||
|
#X connect 37 0 32 0;
|
||||||
|
#X connect 38 0 37 0;
|
||||||
|
#X connect 40 0 39 0;
|
||||||
|
#X connect 41 0 44 0;
|
||||||
|
#X connect 42 0 43 0;
|
||||||
|
#X connect 44 0 2 0;
|
||||||
|
#X restore 24 68 pd tone-generator;
|
||||||
|
#N canvas 76 157 975 436 assigns 0;
|
||||||
|
#X obj 12 71 hip~ 5;
|
||||||
|
#X obj 20 122 int;
|
||||||
|
#X obj 20 96 env~ 8192;
|
||||||
|
#X obj 12 18 adc~ 1;
|
||||||
|
#X obj 22 171 r~ tone-mon;
|
||||||
|
#X obj 31 306 line~;
|
||||||
|
#X obj 12 196 *~;
|
||||||
|
#X obj 31 279 pack 0 50;
|
||||||
|
#X obj 31 253 r tone-ch1;
|
||||||
|
#X obj 22 226 r~ tone-osc;
|
||||||
|
#X obj 22 331 *~;
|
||||||
|
#X obj 12 386 dac~ 1;
|
||||||
|
#X obj 12 361 +~;
|
||||||
|
#X obj 20 44 r tone-hip;
|
||||||
|
#X obj 132 70 hip~ 5;
|
||||||
|
#X obj 140 121 int;
|
||||||
|
#X obj 140 95 env~ 8192;
|
||||||
|
#X obj 142 170 r~ tone-mon;
|
||||||
|
#X obj 151 305 line~;
|
||||||
|
#X obj 132 195 *~;
|
||||||
|
#X obj 151 278 pack 0 50;
|
||||||
|
#X obj 142 225 r~ tone-osc;
|
||||||
|
#X obj 142 330 *~;
|
||||||
|
#X obj 132 360 +~;
|
||||||
|
#X obj 140 43 r tone-hip;
|
||||||
|
#X obj 132 17 adc~ 2;
|
||||||
|
#X obj 132 385 dac~ 2;
|
||||||
|
#X obj 151 252 r tone-ch2;
|
||||||
|
#X obj 254 72 hip~ 5;
|
||||||
|
#X obj 262 123 int;
|
||||||
|
#X obj 262 97 env~ 8192;
|
||||||
|
#X obj 264 172 r~ tone-mon;
|
||||||
|
#X obj 273 307 line~;
|
||||||
|
#X obj 254 197 *~;
|
||||||
|
#X obj 273 280 pack 0 50;
|
||||||
|
#X obj 264 227 r~ tone-osc;
|
||||||
|
#X obj 264 332 *~;
|
||||||
|
#X obj 254 362 +~;
|
||||||
|
#X obj 262 45 r tone-hip;
|
||||||
|
#X obj 370 68 hip~ 5;
|
||||||
|
#X obj 378 119 int;
|
||||||
|
#X obj 378 93 env~ 8192;
|
||||||
|
#X obj 380 168 r~ tone-mon;
|
||||||
|
#X obj 389 303 line~;
|
||||||
|
#X obj 370 193 *~;
|
||||||
|
#X obj 389 276 pack 0 50;
|
||||||
|
#X obj 380 223 r~ tone-osc;
|
||||||
|
#X obj 380 328 *~;
|
||||||
|
#X obj 370 358 +~;
|
||||||
|
#X obj 378 41 r tone-hip;
|
||||||
|
#X obj 487 68 hip~ 5;
|
||||||
|
#X obj 495 119 int;
|
||||||
|
#X obj 495 93 env~ 8192;
|
||||||
|
#X obj 497 168 r~ tone-mon;
|
||||||
|
#X obj 506 303 line~;
|
||||||
|
#X obj 487 193 *~;
|
||||||
|
#X obj 506 276 pack 0 50;
|
||||||
|
#X obj 497 223 r~ tone-osc;
|
||||||
|
#X obj 497 328 *~;
|
||||||
|
#X obj 487 358 +~;
|
||||||
|
#X obj 495 41 r tone-hip;
|
||||||
|
#X obj 607 67 hip~ 5;
|
||||||
|
#X obj 615 118 int;
|
||||||
|
#X obj 615 92 env~ 8192;
|
||||||
|
#X obj 617 167 r~ tone-mon;
|
||||||
|
#X obj 626 302 line~;
|
||||||
|
#X obj 607 192 *~;
|
||||||
|
#X obj 626 275 pack 0 50;
|
||||||
|
#X obj 617 222 r~ tone-osc;
|
||||||
|
#X obj 617 327 *~;
|
||||||
|
#X obj 607 357 +~;
|
||||||
|
#X obj 615 40 r tone-hip;
|
||||||
|
#X obj 254 19 adc~ 3;
|
||||||
|
#X obj 370 15 adc~ 4;
|
||||||
|
#X obj 487 15 adc~ 5;
|
||||||
|
#X obj 607 14 adc~ 6;
|
||||||
|
#X obj 273 254 r tone-ch3;
|
||||||
|
#X obj 389 249 r tone-ch4;
|
||||||
|
#X obj 506 250 r tone-ch5;
|
||||||
|
#X obj 626 249 r tone-ch6;
|
||||||
|
#X obj 254 387 dac~ 3;
|
||||||
|
#X obj 369 382 dac~ 4;
|
||||||
|
#X obj 487 383 dac~ 5;
|
||||||
|
#X obj 607 382 dac~ 6;
|
||||||
|
#X obj 725 72 hip~ 5;
|
||||||
|
#X obj 733 123 int;
|
||||||
|
#X obj 733 97 env~ 8192;
|
||||||
|
#X obj 735 172 r~ tone-mon;
|
||||||
|
#X obj 744 307 line~;
|
||||||
|
#X obj 725 197 *~;
|
||||||
|
#X obj 744 280 pack 0 50;
|
||||||
|
#X obj 735 227 r~ tone-osc;
|
||||||
|
#X obj 735 332 *~;
|
||||||
|
#X obj 725 362 +~;
|
||||||
|
#X obj 733 45 r tone-hip;
|
||||||
|
#X obj 845 71 hip~ 5;
|
||||||
|
#X obj 853 122 int;
|
||||||
|
#X obj 853 96 env~ 8192;
|
||||||
|
#X obj 855 171 r~ tone-mon;
|
||||||
|
#X obj 864 306 line~;
|
||||||
|
#X obj 845 196 *~;
|
||||||
|
#X obj 864 279 pack 0 50;
|
||||||
|
#X obj 855 226 r~ tone-osc;
|
||||||
|
#X obj 855 331 *~;
|
||||||
|
#X obj 845 361 +~;
|
||||||
|
#X obj 853 44 r tone-hip;
|
||||||
|
#X obj 725 19 adc~ 7;
|
||||||
|
#X obj 845 18 adc~ 8;
|
||||||
|
#X obj 725 387 dac~ 7;
|
||||||
|
#X obj 845 386 dac~ 8;
|
||||||
|
#X obj 744 254 r tone-ch7;
|
||||||
|
#X obj 864 253 r tone-ch8;
|
||||||
|
#X obj 20 148 s tone-vu1;
|
||||||
|
#X obj 140 147 s tone-vu2;
|
||||||
|
#X obj 262 149 s tone-vu3;
|
||||||
|
#X obj 378 145 s tone-vu4;
|
||||||
|
#X obj 495 145 s tone-vu5;
|
||||||
|
#X obj 615 144 s tone-vu6;
|
||||||
|
#X obj 733 149 s tone-vu7;
|
||||||
|
#X obj 853 148 s tone-vu8;
|
||||||
|
#X connect 0 0 6 0;
|
||||||
|
#X connect 0 0 2 0;
|
||||||
|
#X connect 1 0 112 0;
|
||||||
|
#X connect 2 0 1 0;
|
||||||
|
#X connect 3 0 0 0;
|
||||||
|
#X connect 4 0 6 1;
|
||||||
|
#X connect 5 0 10 1;
|
||||||
|
#X connect 6 0 12 0;
|
||||||
|
#X connect 7 0 5 0;
|
||||||
|
#X connect 8 0 7 0;
|
||||||
|
#X connect 9 0 10 0;
|
||||||
|
#X connect 10 0 12 1;
|
||||||
|
#X connect 12 0 11 0;
|
||||||
|
#X connect 13 0 0 1;
|
||||||
|
#X connect 14 0 19 0;
|
||||||
|
#X connect 14 0 16 0;
|
||||||
|
#X connect 15 0 113 0;
|
||||||
|
#X connect 16 0 15 0;
|
||||||
|
#X connect 17 0 19 1;
|
||||||
|
#X connect 18 0 22 1;
|
||||||
|
#X connect 19 0 23 0;
|
||||||
|
#X connect 20 0 18 0;
|
||||||
|
#X connect 21 0 22 0;
|
||||||
|
#X connect 22 0 23 1;
|
||||||
|
#X connect 23 0 26 0;
|
||||||
|
#X connect 24 0 14 1;
|
||||||
|
#X connect 25 0 14 0;
|
||||||
|
#X connect 27 0 20 0;
|
||||||
|
#X connect 28 0 33 0;
|
||||||
|
#X connect 28 0 30 0;
|
||||||
|
#X connect 29 0 114 0;
|
||||||
|
#X connect 30 0 29 0;
|
||||||
|
#X connect 31 0 33 1;
|
||||||
|
#X connect 32 0 36 1;
|
||||||
|
#X connect 33 0 37 0;
|
||||||
|
#X connect 34 0 32 0;
|
||||||
|
#X connect 35 0 36 0;
|
||||||
|
#X connect 36 0 37 1;
|
||||||
|
#X connect 37 0 80 0;
|
||||||
|
#X connect 38 0 28 1;
|
||||||
|
#X connect 39 0 44 0;
|
||||||
|
#X connect 39 0 41 0;
|
||||||
|
#X connect 40 0 115 0;
|
||||||
|
#X connect 41 0 40 0;
|
||||||
|
#X connect 42 0 44 1;
|
||||||
|
#X connect 43 0 47 1;
|
||||||
|
#X connect 44 0 48 0;
|
||||||
|
#X connect 45 0 43 0;
|
||||||
|
#X connect 46 0 47 0;
|
||||||
|
#X connect 47 0 48 1;
|
||||||
|
#X connect 48 0 81 0;
|
||||||
|
#X connect 49 0 39 1;
|
||||||
|
#X connect 50 0 55 0;
|
||||||
|
#X connect 50 0 52 0;
|
||||||
|
#X connect 51 0 116 0;
|
||||||
|
#X connect 52 0 51 0;
|
||||||
|
#X connect 53 0 55 1;
|
||||||
|
#X connect 54 0 58 1;
|
||||||
|
#X connect 55 0 59 0;
|
||||||
|
#X connect 56 0 54 0;
|
||||||
|
#X connect 57 0 58 0;
|
||||||
|
#X connect 58 0 59 1;
|
||||||
|
#X connect 59 0 82 0;
|
||||||
|
#X connect 60 0 50 1;
|
||||||
|
#X connect 61 0 66 0;
|
||||||
|
#X connect 61 0 63 0;
|
||||||
|
#X connect 62 0 117 0;
|
||||||
|
#X connect 63 0 62 0;
|
||||||
|
#X connect 64 0 66 1;
|
||||||
|
#X connect 65 0 69 1;
|
||||||
|
#X connect 66 0 70 0;
|
||||||
|
#X connect 67 0 65 0;
|
||||||
|
#X connect 68 0 69 0;
|
||||||
|
#X connect 69 0 70 1;
|
||||||
|
#X connect 70 0 83 0;
|
||||||
|
#X connect 71 0 61 1;
|
||||||
|
#X connect 72 0 28 0;
|
||||||
|
#X connect 73 0 39 0;
|
||||||
|
#X connect 74 0 50 0;
|
||||||
|
#X connect 75 0 61 0;
|
||||||
|
#X connect 76 0 34 0;
|
||||||
|
#X connect 77 0 45 0;
|
||||||
|
#X connect 78 0 56 0;
|
||||||
|
#X connect 79 0 67 0;
|
||||||
|
#X connect 84 0 89 0;
|
||||||
|
#X connect 84 0 86 0;
|
||||||
|
#X connect 85 0 118 0;
|
||||||
|
#X connect 86 0 85 0;
|
||||||
|
#X connect 87 0 89 1;
|
||||||
|
#X connect 88 0 92 1;
|
||||||
|
#X connect 89 0 93 0;
|
||||||
|
#X connect 90 0 88 0;
|
||||||
|
#X connect 91 0 92 0;
|
||||||
|
#X connect 92 0 93 1;
|
||||||
|
#X connect 93 0 108 0;
|
||||||
|
#X connect 94 0 84 1;
|
||||||
|
#X connect 95 0 100 0;
|
||||||
|
#X connect 95 0 97 0;
|
||||||
|
#X connect 96 0 119 0;
|
||||||
|
#X connect 97 0 96 0;
|
||||||
|
#X connect 98 0 100 1;
|
||||||
|
#X connect 99 0 103 1;
|
||||||
|
#X connect 100 0 104 0;
|
||||||
|
#X connect 101 0 99 0;
|
||||||
|
#X connect 102 0 103 0;
|
||||||
|
#X connect 103 0 104 1;
|
||||||
|
#X connect 104 0 109 0;
|
||||||
|
#X connect 105 0 95 1;
|
||||||
|
#X connect 106 0 84 0;
|
||||||
|
#X connect 107 0 95 0;
|
||||||
|
#X connect 110 0 90 0;
|
||||||
|
#X connect 111 0 101 0;
|
||||||
|
#X restore 38 387 pd assigns;
|
||||||
|
#X obj 178 87 loadbang;
|
||||||
|
#X obj 178 111 1;
|
||||||
|
#X connect 1 0 0 0;
|
||||||
|
#X connect 2 0 1 0;
|
||||||
|
#X connect 3 0 2 0;
|
||||||
|
#X connect 4 0 5 0;
|
||||||
|
#X connect 6 0 4 0;
|
||||||
|
#X connect 10 0 11 0;
|
||||||
|
#X connect 11 0 4 0;
|
||||||
|
#X restore 388 243 pd audio;
|
||||||
|
#X floatatom 22 144 3 0 100 1 - tone-level-set tone-level;
|
||||||
|
#X floatatom 84 123 5 0 100 1 pitch tone-pitch-set tone-pitch;
|
||||||
|
#X floatatom 84 145 5 0 20000 1 HZ tone-hz-set tone-hz;
|
||||||
|
#X text 48 145 dB;
|
||||||
|
#X text 34 67 TEST TONES;
|
||||||
|
#X text 233 156 AUDIO OUTPUT ON/OFF;
|
||||||
|
#X text 18 5 Welcome to Pd ("Pure Data"). You can use this window to
|
||||||
|
test audio and MIDI connections. To see Pd's DOCUMENTATION \, select
|
||||||
|
"getting started" in the Help menu.;
|
||||||
|
#X text 18 323 Pd is Free software under the BSD license. See LICENSE.txt
|
||||||
|
in the distribution for details.;
|
||||||
|
#X obj 27 292 bng 20 250 50 0 empty empty empty 17 7 0 10 -262144 -1
|
||||||
|
-1;
|
||||||
|
#X obj 120 293 bng 20 250 50 0 empty empty empty 17 7 0 10 -262144
|
||||||
|
-1 -1;
|
||||||
|
#X text 39 105 60;
|
||||||
|
#X text 39 88 80;
|
||||||
|
#X text 16 163 (100 max);
|
||||||
|
#X connect 1 0 2 0;
|
||||||
|
#X connect 1 1 2 1;
|
||||||
|
#X connect 2 0 3 0;
|
||||||
|
#X connect 2 1 0 0;
|
||||||
|
#X connect 3 0 47 0;
|
||||||
|
#X connect 7 0 48 0;
|
||||||
|
#X connect 8 0 7 0;
|
||||||
|
#X connect 8 1 6 0;
|
||||||
|
#X connect 14 0 9 0;
|
||||||
0
_archive.ringringrain_2011/revised_to_work.txt
Normal file
0
_archive.ringringrain_2011/revised_to_work.txt
Normal file
BIN
_archive.ringringrain_2011/sketchbook/.DS_Store
vendored
Normal file
BIN
_archive.ringringrain_2011/sketchbook/.DS_Store
vendored
Normal file
Binary file not shown.
|
|
@ -0,0 +1,670 @@
|
||||||
|
/*
|
||||||
|
* Firmata is a generic protocol for communicating with microcontrollers
|
||||||
|
* from software on a host computer. It is intended to work with
|
||||||
|
* any host computer software package.
|
||||||
|
*
|
||||||
|
* To download a host software package, please clink on the following link
|
||||||
|
* to open the download page in your default browser.
|
||||||
|
*
|
||||||
|
* http://firmata.org/wiki/Download
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
|
||||||
|
Copyright (C) 2010-2011 Paul Stoffregen. All rights reserved.
|
||||||
|
Copyright (C) 2009 Shigeru Kobayashi. All rights reserved.
|
||||||
|
Copyright (C) 2009-2011 Jeff Hoefs. All rights reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
See file LICENSE.txt for further informations on licensing terms.
|
||||||
|
|
||||||
|
formatted using the GNU C formatting and indenting
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO: use Program Control to load stored profiles from EEPROM
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Servo.h>
|
||||||
|
#include <Wire.h>
|
||||||
|
#include <Firmata.h>
|
||||||
|
|
||||||
|
// move the following defines to Firmata.h?
|
||||||
|
#define I2C_WRITE B00000000
|
||||||
|
#define I2C_READ B00001000
|
||||||
|
#define I2C_READ_CONTINUOUSLY B00010000
|
||||||
|
#define I2C_STOP_READING B00011000
|
||||||
|
#define I2C_READ_WRITE_MODE_MASK B00011000
|
||||||
|
#define I2C_10BIT_ADDRESS_MODE_MASK B00100000
|
||||||
|
|
||||||
|
#define MAX_QUERIES 8
|
||||||
|
#define MINIMUM_SAMPLING_INTERVAL 10
|
||||||
|
|
||||||
|
#define REGISTER_NOT_SPECIFIED -1
|
||||||
|
|
||||||
|
/*==============================================================================
|
||||||
|
* GLOBAL VARIABLES
|
||||||
|
*============================================================================*/
|
||||||
|
|
||||||
|
/* analog inputs */
|
||||||
|
int analogInputsToReport = 0; // bitwise array to store pin reporting
|
||||||
|
|
||||||
|
/* digital input ports */
|
||||||
|
byte reportPINs[TOTAL_PORTS]; // 1 = report this port, 0 = silence
|
||||||
|
byte previousPINs[TOTAL_PORTS]; // previous 8 bits sent
|
||||||
|
|
||||||
|
/* pins configuration */
|
||||||
|
byte pinConfig[TOTAL_PINS]; // configuration of every pin
|
||||||
|
byte portConfigInputs[TOTAL_PORTS]; // each bit: 1 = pin in INPUT, 0 = anything else
|
||||||
|
int pinState[TOTAL_PINS]; // any value that has been written
|
||||||
|
|
||||||
|
/* timer variables */
|
||||||
|
unsigned long currentMillis; // store the current value from millis()
|
||||||
|
unsigned long previousMillis; // for comparison with currentMillis
|
||||||
|
int samplingInterval = 19; // how often to run the main loop (in ms)
|
||||||
|
|
||||||
|
/* i2c data */
|
||||||
|
struct i2c_device_info {
|
||||||
|
byte addr;
|
||||||
|
byte reg;
|
||||||
|
byte bytes;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* for i2c read continuous more */
|
||||||
|
i2c_device_info query[MAX_QUERIES];
|
||||||
|
|
||||||
|
byte i2cRxData[32];
|
||||||
|
boolean isI2CEnabled = false;
|
||||||
|
signed char queryIndex = -1;
|
||||||
|
unsigned int i2cReadDelayTime = 0; // default delay time between i2c read request and Wire.requestFrom()
|
||||||
|
|
||||||
|
Servo servos[MAX_SERVOS];
|
||||||
|
/*==============================================================================
|
||||||
|
* FUNCTIONS
|
||||||
|
*============================================================================*/
|
||||||
|
|
||||||
|
void readAndReportData(byte address, int theRegister, byte numBytes) {
|
||||||
|
// allow I2C requests that don't require a register read
|
||||||
|
// for example, some devices using an interrupt pin to signify new data available
|
||||||
|
// do not always require the register read so upon interrupt you call Wire.requestFrom()
|
||||||
|
if (theRegister != REGISTER_NOT_SPECIFIED) {
|
||||||
|
Wire.beginTransmission(address);
|
||||||
|
#if ARDUINO >= 100
|
||||||
|
Wire.write((byte)theRegister);
|
||||||
|
#else
|
||||||
|
Wire.send((byte)theRegister);
|
||||||
|
#endif
|
||||||
|
Wire.endTransmission();
|
||||||
|
delayMicroseconds(i2cReadDelayTime); // delay is necessary for some devices such as WiiNunchuck
|
||||||
|
} else {
|
||||||
|
theRegister = 0; // fill the register with a dummy value
|
||||||
|
}
|
||||||
|
|
||||||
|
Wire.requestFrom(address, numBytes); // all bytes are returned in requestFrom
|
||||||
|
|
||||||
|
// check to be sure correct number of bytes were returned by slave
|
||||||
|
if(numBytes == Wire.available()) {
|
||||||
|
i2cRxData[0] = address;
|
||||||
|
i2cRxData[1] = theRegister;
|
||||||
|
for (int i = 0; i < numBytes; i++) {
|
||||||
|
#if ARDUINO >= 100
|
||||||
|
i2cRxData[2 + i] = Wire.read();
|
||||||
|
#else
|
||||||
|
i2cRxData[2 + i] = Wire.receive();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(numBytes > Wire.available()) {
|
||||||
|
Firmata.sendString("I2C Read Error: Too many bytes received");
|
||||||
|
} else {
|
||||||
|
Firmata.sendString("I2C Read Error: Too few bytes received");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// send slave address, register and received bytes
|
||||||
|
Firmata.sendSysex(SYSEX_I2C_REPLY, numBytes + 2, i2cRxData);
|
||||||
|
}
|
||||||
|
|
||||||
|
void outputPort(byte portNumber, byte portValue, byte forceSend)
|
||||||
|
{
|
||||||
|
// pins not configured as INPUT are cleared to zeros
|
||||||
|
portValue = portValue & portConfigInputs[portNumber];
|
||||||
|
// only send if the value is different than previously sent
|
||||||
|
if(forceSend || previousPINs[portNumber] != portValue) {
|
||||||
|
Firmata.sendDigitalPort(portNumber, portValue);
|
||||||
|
previousPINs[portNumber] = portValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* check all the active digital inputs for change of state, then add any events
|
||||||
|
* to the Serial output queue using Serial.print() */
|
||||||
|
void checkDigitalInputs(void)
|
||||||
|
{
|
||||||
|
/* Using non-looping code allows constants to be given to readPort().
|
||||||
|
* The compiler will apply substantial optimizations if the inputs
|
||||||
|
* to readPort() are compile-time constants. */
|
||||||
|
if (TOTAL_PORTS > 0 && reportPINs[0]) outputPort(0, readPort(0, portConfigInputs[0]), false);
|
||||||
|
if (TOTAL_PORTS > 1 && reportPINs[1]) outputPort(1, readPort(1, portConfigInputs[1]), false);
|
||||||
|
if (TOTAL_PORTS > 2 && reportPINs[2]) outputPort(2, readPort(2, portConfigInputs[2]), false);
|
||||||
|
if (TOTAL_PORTS > 3 && reportPINs[3]) outputPort(3, readPort(3, portConfigInputs[3]), false);
|
||||||
|
if (TOTAL_PORTS > 4 && reportPINs[4]) outputPort(4, readPort(4, portConfigInputs[4]), false);
|
||||||
|
if (TOTAL_PORTS > 5 && reportPINs[5]) outputPort(5, readPort(5, portConfigInputs[5]), false);
|
||||||
|
if (TOTAL_PORTS > 6 && reportPINs[6]) outputPort(6, readPort(6, portConfigInputs[6]), false);
|
||||||
|
if (TOTAL_PORTS > 7 && reportPINs[7]) outputPort(7, readPort(7, portConfigInputs[7]), false);
|
||||||
|
if (TOTAL_PORTS > 8 && reportPINs[8]) outputPort(8, readPort(8, portConfigInputs[8]), false);
|
||||||
|
if (TOTAL_PORTS > 9 && reportPINs[9]) outputPort(9, readPort(9, portConfigInputs[9]), false);
|
||||||
|
if (TOTAL_PORTS > 10 && reportPINs[10]) outputPort(10, readPort(10, portConfigInputs[10]), false);
|
||||||
|
if (TOTAL_PORTS > 11 && reportPINs[11]) outputPort(11, readPort(11, portConfigInputs[11]), false);
|
||||||
|
if (TOTAL_PORTS > 12 && reportPINs[12]) outputPort(12, readPort(12, portConfigInputs[12]), false);
|
||||||
|
if (TOTAL_PORTS > 13 && reportPINs[13]) outputPort(13, readPort(13, portConfigInputs[13]), false);
|
||||||
|
if (TOTAL_PORTS > 14 && reportPINs[14]) outputPort(14, readPort(14, portConfigInputs[14]), false);
|
||||||
|
if (TOTAL_PORTS > 15 && reportPINs[15]) outputPort(15, readPort(15, portConfigInputs[15]), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
/* sets the pin mode to the correct state and sets the relevant bits in the
|
||||||
|
* two bit-arrays that track Digital I/O and PWM status
|
||||||
|
*/
|
||||||
|
void setPinModeCallback(byte pin, int mode)
|
||||||
|
{
|
||||||
|
if (pinConfig[pin] == I2C && isI2CEnabled && mode != I2C) {
|
||||||
|
// disable i2c so pins can be used for other functions
|
||||||
|
// the following if statements should reconfigure the pins properly
|
||||||
|
disableI2CPins();
|
||||||
|
}
|
||||||
|
if (IS_PIN_SERVO(pin) && mode != SERVO && servos[PIN_TO_SERVO(pin)].attached()) {
|
||||||
|
servos[PIN_TO_SERVO(pin)].detach();
|
||||||
|
}
|
||||||
|
if (IS_PIN_ANALOG(pin)) {
|
||||||
|
reportAnalogCallback(PIN_TO_ANALOG(pin), mode == ANALOG ? 1 : 0); // turn on/off reporting
|
||||||
|
}
|
||||||
|
if (IS_PIN_DIGITAL(pin)) {
|
||||||
|
if (mode == INPUT) {
|
||||||
|
portConfigInputs[pin/8] |= (1 << (pin & 7));
|
||||||
|
} else {
|
||||||
|
portConfigInputs[pin/8] &= ~(1 << (pin & 7));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pinState[pin] = 0;
|
||||||
|
switch(mode) {
|
||||||
|
case ANALOG:
|
||||||
|
if (IS_PIN_ANALOG(pin)) {
|
||||||
|
if (IS_PIN_DIGITAL(pin)) {
|
||||||
|
pinMode(PIN_TO_DIGITAL(pin), INPUT); // disable output driver
|
||||||
|
//digitalWrite(PIN_TO_DIGITAL(pin), LOW); // disable internal pull-ups
|
||||||
|
digitalWrite(PIN_TO_DIGITAL(pin), HIGH); // enable internal pull-ups
|
||||||
|
}
|
||||||
|
pinConfig[pin] = ANALOG;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case INPUT:
|
||||||
|
if (IS_PIN_DIGITAL(pin)) {
|
||||||
|
pinMode(PIN_TO_DIGITAL(pin), INPUT); // disable output driver
|
||||||
|
//digitalWrite(PIN_TO_DIGITAL(pin), LOW); // disable internal pull-ups
|
||||||
|
digitalWrite(PIN_TO_DIGITAL(pin), HIGH); // enable internal pull-ups
|
||||||
|
pinConfig[pin] = INPUT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OUTPUT:
|
||||||
|
if (IS_PIN_DIGITAL(pin)) {
|
||||||
|
digitalWrite(PIN_TO_DIGITAL(pin), LOW); // disable PWM
|
||||||
|
pinMode(PIN_TO_DIGITAL(pin), OUTPUT);
|
||||||
|
pinConfig[pin] = OUTPUT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PWM:
|
||||||
|
if (IS_PIN_PWM(pin)) {
|
||||||
|
pinMode(PIN_TO_PWM(pin), OUTPUT);
|
||||||
|
analogWrite(PIN_TO_PWM(pin), 0);
|
||||||
|
pinConfig[pin] = PWM;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SERVO:
|
||||||
|
if (IS_PIN_SERVO(pin)) {
|
||||||
|
pinConfig[pin] = SERVO;
|
||||||
|
if (!servos[PIN_TO_SERVO(pin)].attached()) {
|
||||||
|
servos[PIN_TO_SERVO(pin)].attach(PIN_TO_DIGITAL(pin));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case I2C:
|
||||||
|
if (IS_PIN_I2C(pin)) {
|
||||||
|
// mark the pin as i2c
|
||||||
|
// the user must call I2C_CONFIG to enable I2C for a device
|
||||||
|
pinConfig[pin] = I2C;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Firmata.sendString("Unknown pin mode"); // TODO: put error msgs in EEPROM
|
||||||
|
}
|
||||||
|
// TODO: save status to EEPROM here, if changed
|
||||||
|
}
|
||||||
|
|
||||||
|
void analogWriteCallback(byte pin, int value)
|
||||||
|
{
|
||||||
|
if (pin < TOTAL_PINS) {
|
||||||
|
switch(pinConfig[pin]) {
|
||||||
|
case SERVO:
|
||||||
|
if (IS_PIN_SERVO(pin))
|
||||||
|
servos[PIN_TO_SERVO(pin)].write(value);
|
||||||
|
pinState[pin] = value;
|
||||||
|
break;
|
||||||
|
case PWM:
|
||||||
|
if (IS_PIN_PWM(pin))
|
||||||
|
analogWrite(PIN_TO_PWM(pin), value);
|
||||||
|
pinState[pin] = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void digitalWriteCallback(byte port, int value)
|
||||||
|
{
|
||||||
|
byte pin, lastPin, mask=1, pinWriteMask=0;
|
||||||
|
|
||||||
|
if (port < TOTAL_PORTS) {
|
||||||
|
// create a mask of the pins on this port that are writable.
|
||||||
|
lastPin = port*8+8;
|
||||||
|
if (lastPin > TOTAL_PINS) lastPin = TOTAL_PINS;
|
||||||
|
for (pin=port*8; pin < lastPin; pin++) {
|
||||||
|
// do not disturb non-digital pins (eg, Rx & Tx)
|
||||||
|
if (IS_PIN_DIGITAL(pin)) {
|
||||||
|
// only write to OUTPUT and INPUT (enables pullup)
|
||||||
|
// do not touch pins in PWM, ANALOG, SERVO or other modes
|
||||||
|
if (pinConfig[pin] == OUTPUT || pinConfig[pin] == INPUT) {
|
||||||
|
pinWriteMask |= mask;
|
||||||
|
pinState[pin] = ((byte)value & mask) ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mask = mask << 1;
|
||||||
|
}
|
||||||
|
writePort(port, (byte)value, pinWriteMask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
/* sets bits in a bit array (int) to toggle the reporting of the analogIns
|
||||||
|
*/
|
||||||
|
//void FirmataClass::setAnalogPinReporting(byte pin, byte state) {
|
||||||
|
//}
|
||||||
|
void reportAnalogCallback(byte analogPin, int value)
|
||||||
|
{
|
||||||
|
if (analogPin < TOTAL_ANALOG_PINS) {
|
||||||
|
if(value == 0) {
|
||||||
|
analogInputsToReport = analogInputsToReport &~ (1 << analogPin);
|
||||||
|
} else {
|
||||||
|
analogInputsToReport = analogInputsToReport | (1 << analogPin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO: save status to EEPROM here, if changed
|
||||||
|
}
|
||||||
|
|
||||||
|
void reportDigitalCallback(byte port, int value)
|
||||||
|
{
|
||||||
|
if (port < TOTAL_PORTS) {
|
||||||
|
reportPINs[port] = (byte)value;
|
||||||
|
}
|
||||||
|
// do not disable analog reporting on these 8 pins, to allow some
|
||||||
|
// pins used for digital, others analog. Instead, allow both types
|
||||||
|
// of reporting to be enabled, but check if the pin is configured
|
||||||
|
// as analog when sampling the analog inputs. Likewise, while
|
||||||
|
// scanning digital pins, portConfigInputs will mask off values from any
|
||||||
|
// pins configured as analog
|
||||||
|
}
|
||||||
|
|
||||||
|
/*==============================================================================
|
||||||
|
* SYSEX-BASED commands
|
||||||
|
*============================================================================*/
|
||||||
|
|
||||||
|
void sysexCallback(byte command, byte argc, byte *argv)
|
||||||
|
{
|
||||||
|
byte mode;
|
||||||
|
byte slaveAddress;
|
||||||
|
byte slaveRegister;
|
||||||
|
byte data;
|
||||||
|
unsigned int delayTime;
|
||||||
|
|
||||||
|
switch(command) {
|
||||||
|
case I2C_REQUEST:
|
||||||
|
mode = argv[1] & I2C_READ_WRITE_MODE_MASK;
|
||||||
|
if (argv[1] & I2C_10BIT_ADDRESS_MODE_MASK) {
|
||||||
|
Firmata.sendString("10-bit addressing mode is not yet supported");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
slaveAddress = argv[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(mode) {
|
||||||
|
case I2C_WRITE:
|
||||||
|
Wire.beginTransmission(slaveAddress);
|
||||||
|
for (byte i = 2; i < argc; i += 2) {
|
||||||
|
data = argv[i] + (argv[i + 1] << 7);
|
||||||
|
#if ARDUINO >= 100
|
||||||
|
Wire.write(data);
|
||||||
|
#else
|
||||||
|
Wire.send(data);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
Wire.endTransmission();
|
||||||
|
delayMicroseconds(70);
|
||||||
|
break;
|
||||||
|
case I2C_READ:
|
||||||
|
if (argc == 6) {
|
||||||
|
// a slave register is specified
|
||||||
|
slaveRegister = argv[2] + (argv[3] << 7);
|
||||||
|
data = argv[4] + (argv[5] << 7); // bytes to read
|
||||||
|
readAndReportData(slaveAddress, (int)slaveRegister, data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// a slave register is NOT specified
|
||||||
|
data = argv[2] + (argv[3] << 7); // bytes to read
|
||||||
|
readAndReportData(slaveAddress, (int)REGISTER_NOT_SPECIFIED, data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case I2C_READ_CONTINUOUSLY:
|
||||||
|
if ((queryIndex + 1) >= MAX_QUERIES) {
|
||||||
|
// too many queries, just ignore
|
||||||
|
Firmata.sendString("too many queries");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
queryIndex++;
|
||||||
|
query[queryIndex].addr = slaveAddress;
|
||||||
|
query[queryIndex].reg = argv[2] + (argv[3] << 7);
|
||||||
|
query[queryIndex].bytes = argv[4] + (argv[5] << 7);
|
||||||
|
break;
|
||||||
|
case I2C_STOP_READING:
|
||||||
|
byte queryIndexToSkip;
|
||||||
|
// if read continuous mode is enabled for only 1 i2c device, disable
|
||||||
|
// read continuous reporting for that device
|
||||||
|
if (queryIndex <= 0) {
|
||||||
|
queryIndex = -1;
|
||||||
|
} else {
|
||||||
|
// if read continuous mode is enabled for multiple devices,
|
||||||
|
// determine which device to stop reading and remove it's data from
|
||||||
|
// the array, shifiting other array data to fill the space
|
||||||
|
for (byte i = 0; i < queryIndex + 1; i++) {
|
||||||
|
if (query[i].addr = slaveAddress) {
|
||||||
|
queryIndexToSkip = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (byte i = queryIndexToSkip; i<queryIndex + 1; i++) {
|
||||||
|
if (i < MAX_QUERIES) {
|
||||||
|
query[i].addr = query[i+1].addr;
|
||||||
|
query[i].reg = query[i+1].addr;
|
||||||
|
query[i].bytes = query[i+1].bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
queryIndex--;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case I2C_CONFIG:
|
||||||
|
delayTime = (argv[0] + (argv[1] << 7));
|
||||||
|
|
||||||
|
if(delayTime > 0) {
|
||||||
|
i2cReadDelayTime = delayTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isI2CEnabled) {
|
||||||
|
enableI2CPins();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case SERVO_CONFIG:
|
||||||
|
if(argc > 4) {
|
||||||
|
// these vars are here for clarity, they'll optimized away by the compiler
|
||||||
|
byte pin = argv[0];
|
||||||
|
int minPulse = argv[1] + (argv[2] << 7);
|
||||||
|
int maxPulse = argv[3] + (argv[4] << 7);
|
||||||
|
|
||||||
|
if (IS_PIN_SERVO(pin)) {
|
||||||
|
if (servos[PIN_TO_SERVO(pin)].attached())
|
||||||
|
servos[PIN_TO_SERVO(pin)].detach();
|
||||||
|
servos[PIN_TO_SERVO(pin)].attach(PIN_TO_DIGITAL(pin), minPulse, maxPulse);
|
||||||
|
setPinModeCallback(pin, SERVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SAMPLING_INTERVAL:
|
||||||
|
if (argc > 1) {
|
||||||
|
samplingInterval = argv[0] + (argv[1] << 7);
|
||||||
|
if (samplingInterval < MINIMUM_SAMPLING_INTERVAL) {
|
||||||
|
samplingInterval = MINIMUM_SAMPLING_INTERVAL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//Firmata.sendString("Not enough data");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case EXTENDED_ANALOG:
|
||||||
|
if (argc > 1) {
|
||||||
|
int val = argv[1];
|
||||||
|
if (argc > 2) val |= (argv[2] << 7);
|
||||||
|
if (argc > 3) val |= (argv[3] << 14);
|
||||||
|
analogWriteCallback(argv[0], val);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CAPABILITY_QUERY:
|
||||||
|
Serial.write(START_SYSEX);
|
||||||
|
Serial.write(CAPABILITY_RESPONSE);
|
||||||
|
for (byte pin=0; pin < TOTAL_PINS; pin++) {
|
||||||
|
if (IS_PIN_DIGITAL(pin)) {
|
||||||
|
Serial.write((byte)INPUT);
|
||||||
|
Serial.write(1);
|
||||||
|
Serial.write((byte)OUTPUT);
|
||||||
|
Serial.write(1);
|
||||||
|
}
|
||||||
|
if (IS_PIN_ANALOG(pin)) {
|
||||||
|
Serial.write(ANALOG);
|
||||||
|
Serial.write(10);
|
||||||
|
}
|
||||||
|
if (IS_PIN_PWM(pin)) {
|
||||||
|
Serial.write(PWM);
|
||||||
|
Serial.write(8);
|
||||||
|
}
|
||||||
|
if (IS_PIN_SERVO(pin)) {
|
||||||
|
Serial.write(SERVO);
|
||||||
|
Serial.write(14);
|
||||||
|
}
|
||||||
|
if (IS_PIN_I2C(pin)) {
|
||||||
|
Serial.write(I2C);
|
||||||
|
Serial.write(1); // to do: determine appropriate value
|
||||||
|
}
|
||||||
|
Serial.write(127);
|
||||||
|
}
|
||||||
|
Serial.write(END_SYSEX);
|
||||||
|
break;
|
||||||
|
case PIN_STATE_QUERY:
|
||||||
|
if (argc > 0) {
|
||||||
|
byte pin=argv[0];
|
||||||
|
Serial.write(START_SYSEX);
|
||||||
|
Serial.write(PIN_STATE_RESPONSE);
|
||||||
|
Serial.write(pin);
|
||||||
|
if (pin < TOTAL_PINS) {
|
||||||
|
Serial.write((byte)pinConfig[pin]);
|
||||||
|
Serial.write((byte)pinState[pin] & 0x7F);
|
||||||
|
if (pinState[pin] & 0xFF80) Serial.write((byte)(pinState[pin] >> 7) & 0x7F);
|
||||||
|
if (pinState[pin] & 0xC000) Serial.write((byte)(pinState[pin] >> 14) & 0x7F);
|
||||||
|
}
|
||||||
|
Serial.write(END_SYSEX);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ANALOG_MAPPING_QUERY:
|
||||||
|
Serial.write(START_SYSEX);
|
||||||
|
Serial.write(ANALOG_MAPPING_RESPONSE);
|
||||||
|
for (byte pin=0; pin < TOTAL_PINS; pin++) {
|
||||||
|
Serial.write(IS_PIN_ANALOG(pin) ? PIN_TO_ANALOG(pin) : 127);
|
||||||
|
}
|
||||||
|
Serial.write(END_SYSEX);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableI2CPins()
|
||||||
|
{
|
||||||
|
byte i;
|
||||||
|
// is there a faster way to do this? would probaby require importing
|
||||||
|
// Arduino.h to get SCL and SDA pins
|
||||||
|
for (i=0; i < TOTAL_PINS; i++) {
|
||||||
|
if(IS_PIN_I2C(i)) {
|
||||||
|
// mark pins as i2c so they are ignore in non i2c data requests
|
||||||
|
setPinModeCallback(i, I2C);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isI2CEnabled = true;
|
||||||
|
|
||||||
|
// is there enough time before the first I2C request to call this here?
|
||||||
|
Wire.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* disable the i2c pins so they can be used for other functions */
|
||||||
|
void disableI2CPins() {
|
||||||
|
isI2CEnabled = false;
|
||||||
|
// disable read continuous mode for all devices
|
||||||
|
queryIndex = -1;
|
||||||
|
// uncomment the following if or when the end() method is added to Wire library
|
||||||
|
// Wire.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*==============================================================================
|
||||||
|
* SETUP()
|
||||||
|
*============================================================================*/
|
||||||
|
|
||||||
|
void systemResetCallback()
|
||||||
|
{
|
||||||
|
// initialize a defalt state
|
||||||
|
// TODO: option to load config from EEPROM instead of default
|
||||||
|
if (isI2CEnabled) {
|
||||||
|
disableI2CPins();
|
||||||
|
}
|
||||||
|
/*for (byte i=0; i < TOTAL_PORTS; i++) {
|
||||||
|
reportPINs[i] = false; // by default, reporting off
|
||||||
|
portConfigInputs[i] = 0; // until activated
|
||||||
|
previousPINs[i] = 0;
|
||||||
|
}*/
|
||||||
|
// auto-init as all available pins as digital inputs.
|
||||||
|
// void reportDigitalCallback(byte port, int value) ==> this treats 'reportPINs'
|
||||||
|
reportDigitalCallback(0, 1);
|
||||||
|
reportDigitalCallback(1, 1);
|
||||||
|
reportDigitalCallback(2, 1);
|
||||||
|
// void setPinModeCallback(byte pin, int mode) ==> this treats 'portConfigInputs' / for 'previousPINs', have a look 'void outputPort(byte portNumber, byte portValue, byte forceSend)' ... '// only send if the value is different than previously sent'
|
||||||
|
setPinModeCallback(2, INPUT);
|
||||||
|
setPinModeCallback(3, INPUT);
|
||||||
|
setPinModeCallback(4, INPUT);
|
||||||
|
setPinModeCallback(5, INPUT);
|
||||||
|
setPinModeCallback(6, INPUT);
|
||||||
|
setPinModeCallback(7, INPUT);
|
||||||
|
setPinModeCallback(8, INPUT);
|
||||||
|
setPinModeCallback(9, INPUT);
|
||||||
|
setPinModeCallback(10, INPUT);
|
||||||
|
setPinModeCallback(11, INPUT);
|
||||||
|
setPinModeCallback(12, INPUT);
|
||||||
|
//setPinModeCallback(13, INPUT);
|
||||||
|
//
|
||||||
|
// firmate does not blocking 'digital input on pin 13'
|
||||||
|
// but, real cause comes out of the board design.
|
||||||
|
// ==> NOTE: Digital pin 13 is harder to use as a digital input than the other digital pins because it has an LED and resistor attached to it that's soldered to the board on most boards. If you enable its internal 20k pull-up resistor, it will hang at around 1.7 V instead of the expected 5V because the onboard LED and series resistor pull the voltage level down, meaning it always returns LOW.
|
||||||
|
// (http://arduino.cc/en/Tutorial/DigitalPins)
|
||||||
|
// so, it is, 'by h/w design', not feasible.
|
||||||
|
//
|
||||||
|
setPinModeCallback(14, INPUT);
|
||||||
|
setPinModeCallback(15, INPUT);
|
||||||
|
setPinModeCallback(16, INPUT);
|
||||||
|
setPinModeCallback(17, INPUT);
|
||||||
|
setPinModeCallback(18, INPUT);
|
||||||
|
setPinModeCallback(19, INPUT);
|
||||||
|
|
||||||
|
// pins with analog capability default to analog input
|
||||||
|
// otherwise, pins default to digital output
|
||||||
|
/*for (byte i=0; i < TOTAL_PINS; i++) {
|
||||||
|
if (IS_PIN_ANALOG(i)) {
|
||||||
|
// turns off pullup, configures everything
|
||||||
|
setPinModeCallback(i, ANALOG);
|
||||||
|
} else {
|
||||||
|
// sets the output to 0, configures portConfigInputs
|
||||||
|
setPinModeCallback(i, OUTPUT);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
// by default, do not report any analog inputs
|
||||||
|
analogInputsToReport = 0;
|
||||||
|
|
||||||
|
/* send digital inputs to set the initial state on the host computer,
|
||||||
|
* since once in the loop(), this firmware will only send on change */
|
||||||
|
/*
|
||||||
|
TODO: this can never execute, since no pins default to digital input
|
||||||
|
but it will be needed when/if we support EEPROM stored config
|
||||||
|
for (byte i=0; i < TOTAL_PORTS; i++) {
|
||||||
|
outputPort(i, readPort(i, portConfigInputs[i]), true);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Firmata.setFirmwareVersion(FIRMATA_MAJOR_VERSION, FIRMATA_MINOR_VERSION);
|
||||||
|
|
||||||
|
Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
|
||||||
|
Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback);
|
||||||
|
Firmata.attach(REPORT_ANALOG, reportAnalogCallback);
|
||||||
|
Firmata.attach(REPORT_DIGITAL, reportDigitalCallback);
|
||||||
|
Firmata.attach(SET_PIN_MODE, setPinModeCallback);
|
||||||
|
Firmata.attach(START_SYSEX, sysexCallback);
|
||||||
|
Firmata.attach(SYSTEM_RESET, systemResetCallback);
|
||||||
|
|
||||||
|
Firmata.begin(57600);
|
||||||
|
systemResetCallback(); // reset to default config
|
||||||
|
}
|
||||||
|
|
||||||
|
/*==============================================================================
|
||||||
|
* LOOP()
|
||||||
|
*============================================================================*/
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
byte pin, analogPin;
|
||||||
|
|
||||||
|
/* DIGITALREAD - as fast as possible, check for changes and output them to the
|
||||||
|
* FTDI buffer using Serial.print() */
|
||||||
|
checkDigitalInputs();
|
||||||
|
|
||||||
|
/* SERIALREAD - processing incoming messagse as soon as possible, while still
|
||||||
|
* checking digital inputs. */
|
||||||
|
while(Firmata.available())
|
||||||
|
Firmata.processInput();
|
||||||
|
|
||||||
|
/* SEND FTDI WRITE BUFFER - make sure that the FTDI buffer doesn't go over
|
||||||
|
* 60 bytes. use a timer to sending an event character every 4 ms to
|
||||||
|
* trigger the buffer to dump. */
|
||||||
|
|
||||||
|
currentMillis = millis();
|
||||||
|
if (currentMillis - previousMillis > samplingInterval) {
|
||||||
|
previousMillis += samplingInterval;
|
||||||
|
/* ANALOGREAD - do all analogReads() at the configured sampling interval */
|
||||||
|
for(pin=0; pin<TOTAL_PINS; pin++) {
|
||||||
|
if (IS_PIN_ANALOG(pin) && pinConfig[pin] == ANALOG) {
|
||||||
|
analogPin = PIN_TO_ANALOG(pin);
|
||||||
|
if (analogInputsToReport & (1 << analogPin)) {
|
||||||
|
Firmata.sendAnalog(analogPin, analogRead(analogPin));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// report i2c data for all device with read continuous mode enabled
|
||||||
|
if (queryIndex > -1) {
|
||||||
|
for (byte i = 0; i < queryIndex + 1; i++) {
|
||||||
|
readAndReportData(query[i].addr, query[i].reg, query[i].bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1183
arduino-wifi.pd
Normal file
1183
arduino-wifi.pd
Normal file
File diff suppressed because it is too large
Load diff
116
arduino/rainboard/rainboard.ino
Normal file
116
arduino/rainboard/rainboard.ino
Normal file
|
|
@ -0,0 +1,116 @@
|
||||||
|
#include <ConfigurableFirmata.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
const char* ssid = "TEEPOT";
|
||||||
|
const char* password = "3333388888";
|
||||||
|
const int NETWORK_PORT = 27016;
|
||||||
|
|
||||||
|
//// A UDP instance to let us send and receive packets over UDP
|
||||||
|
//WiFiUDP Udp;
|
||||||
|
//const IPAddress outIp(192,168,43,13); // remote IP (not needed for receive)
|
||||||
|
//const unsigned int outPort = 9999; // remote port (not needed for receive)
|
||||||
|
//const unsigned int localPort = 8888; // local port to listen for UDP packets (here's where we send the packets)
|
||||||
|
|
||||||
|
|
||||||
|
#include <WiFi.h>
|
||||||
|
#include "utility/WiFiClientStream.h"
|
||||||
|
#include "utility/WiFiServerStream.h"
|
||||||
|
WiFiServerStream serverStream(NETWORK_PORT);
|
||||||
|
|
||||||
|
std::vector<int> pins = {16, 15, 17, 18, 20, 19, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33}; //16
|
||||||
|
//2 ==> flipping autonomously 1/0 without grounding! (maybe grounded by something else???)
|
||||||
|
//1, 3, 4, 5, 6, 7, 8, ==> flipping 1/0 ... while grounded manually.
|
||||||
|
|
||||||
|
//i have a feeling ... this relates to 'touch sensing'... this precise flipping might be from cap. charge/discharge cycles?
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
//pinmodes
|
||||||
|
for (int idx = 0; idx < pins.size(); idx++) {
|
||||||
|
pinMode(pins[idx], INPUT_PULLUP);
|
||||||
|
}
|
||||||
|
|
||||||
|
//serial
|
||||||
|
Serial.begin(115200);
|
||||||
|
|
||||||
|
//wifi
|
||||||
|
WiFi.mode(WIFI_STA);
|
||||||
|
// Connect to WiFi network
|
||||||
|
Serial.println();
|
||||||
|
Serial.println();
|
||||||
|
Serial.print("Connecting to ");
|
||||||
|
Serial.println(ssid);
|
||||||
|
WiFi.begin(ssid, password);
|
||||||
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
|
delay(500);
|
||||||
|
Serial.print(".");
|
||||||
|
}
|
||||||
|
Serial.println("");
|
||||||
|
|
||||||
|
Serial.println("WiFi connected");
|
||||||
|
Serial.println("IP address: ");
|
||||||
|
Serial.println(WiFi.localIP());
|
||||||
|
|
||||||
|
//firmata
|
||||||
|
Firmata.disableBlinkVersion();
|
||||||
|
Firmata.begin(serverStream);
|
||||||
|
|
||||||
|
// Firmata.begin(115200);
|
||||||
|
// Firmata.setFirmwareNameAndVersion("ConfigurableFirmata", FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
for (int idx = 0; idx < pins.size(); idx++) {
|
||||||
|
Firmata.sendAnalog(idx, digitalRead(pins[idx])*1023);
|
||||||
|
}
|
||||||
|
|
||||||
|
serverStream.maintain();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// [NOTE]
|
||||||
|
// because firmata analog way has limits of max. channels <= 16. you can use digital way.. like below.
|
||||||
|
// but this not yet confirmed whether it is working or not.
|
||||||
|
//
|
||||||
|
|
||||||
|
// #include <ConfigurableFirmata.h>
|
||||||
|
|
||||||
|
// int pins_port0[8] = {17, 18, 2, 3, 4, 5, 6, 7};
|
||||||
|
// int pins_port1[8] = {8, 9, 10, 11, 12, 24, 25, 26};
|
||||||
|
// int pins_port2[8] = {27, 28, 29, 30, 31, 32, 33, 33};
|
||||||
|
|
||||||
|
// void setup()
|
||||||
|
// {
|
||||||
|
// for (int idx = 0; idx < 8; idx++) pinMode(pins_port0[idx], INPUT_PULLUP);
|
||||||
|
// for (int idx = 0; idx < 8; idx++) pinMode(pins_port1[idx], INPUT_PULLUP);
|
||||||
|
// for (int idx = 0; idx < 8; idx++) pinMode(pins_port2[idx], INPUT_PULLUP);
|
||||||
|
|
||||||
|
// Firmata.setFirmwareNameAndVersion("ConfigurableFirmata", FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION);
|
||||||
|
// Firmata.begin(115200);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// void loop()
|
||||||
|
// {
|
||||||
|
// byte port = 0;
|
||||||
|
|
||||||
|
// static byte port0_prev = 0;
|
||||||
|
// port = 0x00;
|
||||||
|
// for (int idx = 0; idx < 8; idx++) port |= (digitalRead(pins_port0[idx]) ? 0x01<<idx : 0x00);
|
||||||
|
// if (port0_prev != port) Firmata.sendDigitalPort(0, port);
|
||||||
|
// port0_prev = port;
|
||||||
|
|
||||||
|
// static byte port1_prev = 0;
|
||||||
|
// port = 0x00;
|
||||||
|
// for (int idx = 0; idx < 8; idx++) port |= (digitalRead(pins_port1[idx]) ? 0x01<<idx : 0x00);
|
||||||
|
// if (port1_prev != port) Firmata.sendDigitalPort(1, port);
|
||||||
|
// port1_prev = port;
|
||||||
|
|
||||||
|
// static byte port2_prev = 0;
|
||||||
|
// port = 0x00;
|
||||||
|
// for (int idx = 0; idx < 8; idx++) port |= (digitalRead(pins_port2[idx]) ? 0x01<<idx : 0x00);
|
||||||
|
// if (port2_prev != port) Firmata.sendDigitalPort(2, port);
|
||||||
|
// port2_prev = port;
|
||||||
|
|
||||||
|
// delay(20);
|
||||||
|
// }
|
||||||
1022
paperPerfm2023_rev2.pd
Normal file
1022
paperPerfm2023_rev2.pd
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue