added files; minor edits

master
riviera 7 months ago
parent 62bdbeb2fd
commit ccdf0022b0

@ -0,0 +1,63 @@
-- printer-jam.hs
:set -package hosc
:set -package bytestring
:set -XOverloadedStrings
:set prompt ""
import qualified Data.ByteString.Char8 as ByteString.Char8 {- bytestring -}
import Sound.Tidal.Context
import Sound.Osc.Fd as O
-- type Ascii = ByteString.Char8.ByteString
-- :{
-- ascii_to_controlPattern :: O.Ascii -> ControlPattern
-- ascii_to_controlPattern =
-- :}
import System.IO (hSetEncoding, stdout, utf8)
hSetEncoding stdout utf8
:{
let printerTarget =
Target {oName = "printer", -- A friendly name for the target
oAddress = "192.168.1.171", -- The target's network address
oPort = 10000, -- The network port the target is listening on
oLatency = 0.2, -- smooth out network jitter
oSchedule = Live, -- The scheduling method
oWindow = Nothing, -- Not yet used
oHandshake = False, -- SuperDirt specific
oBusPort = Nothing -- Also SuperDirt specific
}
printerFormats = [OSC "/{device}/{motor}/{action}" $ ArgList [("action", Just $ VS "f")],
OSC "/{device}/{motor}/speed" $ ArgList [("speed", Just $ VF 0)],
OSC "/{device}/{action}" $ ArgList [("action", Just $ VS "f")],
OSC "/{device}/mode" $ ArgList [("mode", Just $ VI 1)],
OSC "/{device}/steps" $ ArgList [("steps", Just $ VF 0)],
OSC "/{device}/rpm" $ ArgList [("rpm", Just $ VF 0)]]
-- OSC "/stopall" $ ArgList [("stop", Just $ VS "printer")]]
-- ("speed", Just $ VI 0),
-- ("action", Just $ VS "r")
action = pS "action"
device = pS "device"
motor = pS "motor"
speed = pF "speed"
mode = pI "mode"
steps = pF "steps"
rpm = pF "rpm"
oscmap = [(printerTarget, printerFormats)]
:}
tidal <- startStream (defaultConfig {cCtrlAddr = "0.0.0.0", cCtrlPort = 6060}) oscmap
:{
let p1 = streamReplace tidal 1
p2 = streamReplace tidal 2
p3 = streamReplace tidal 3
p4 = streamReplace tidal 4
:}
:set prompt "tidal> "
:set prompt-cont ""

@ -0,0 +1,56 @@
-- printer-jam.hs
:set -package hosc
:set -package bytestring
:set -XOverloadedStrings
:set prompt ""
import qualified Data.ByteString.Char8 as ByteString.Char8 {- bytestring -}
import Sound.Tidal.Context
import Sound.Osc.Fd as O
-- type Ascii = ByteString.Char8.ByteString
-- :{
-- ascii_to_controlPattern :: O.Ascii -> ControlPattern
-- ascii_to_controlPattern =
-- :}
import System.IO (hSetEncoding, stdout, utf8)
hSetEncoding stdout utf8
:{
let printerTarget =
Target {oName = "printer", -- A friendly name for the target
oAddress = "192.168.1.171", -- The target's network address
oPort = 10000, -- The network port the target is listening on
oLatency = 0.15, -- smooth out network jitter
oSchedule = Live, -- The scheduling method
oWindow = Nothing, -- Not yet used
oHandshake = False, -- SuperDirt specific
oBusPort = Nothing -- Also SuperDirt specific
}
printerFormats = [OSC "/{device}/{motor}/{action}" $ ArgList [("action", Just $ VS "f")],
OSC "/{device}/{motor}/speed" $ ArgList [("speed", Just $ VF 0)]]
-- OSC "/stopall" $ ArgList [("stop", Just $ VS "printer")]]
-- ("speed", Just $ VI 0),
-- ("action", Just $ VS "r")
action = pS "action"
device = pS "device"
motor = pS "motor"
speed = pF "speed"
oscmap = [(printerTarget, printerFormats)]
:}
tidal <- startStream (defaultConfig {cCtrlAddr = "0.0.0.0", cCtrlPort = 6060}) oscmap
:{
let p1 = streamReplace tidal 1
p2 = streamReplace tidal 2
p3 = streamReplace tidal 3
p4 = streamReplace tidal 4
:}
:set prompt "tidal> "
:set prompt-cont ""

@ -0,0 +1,10 @@
UPLOAD_PORT = /dev/ttyUSB0
LIBS = /home/riviera/Arduino/libraries/ArduinoOSC /home/riviera/Arduino/libraries/ArxTypeTraits /home/riviera/Arduino/libraries/ArxSmartPtr /home/riviera/Arduino/libraries/ArxContainer /home/riviera/Arduino/libraries/DebugLog /home/riviera/Arduino/libraries/Adafruit_Motor_Shield_V2_Library /home/riviera/Arduino/libraries/Adafruit_GFX_Library /home/riviera/Arduino/libraries/Adafruit_BusIO /home/riviera/Arduino/libraries/Adafruit_ILI9341 /home/riviera/Arduino/libraries/Adafruit_SH110X /home/riviera/Arduino/libraries/Adafruit_SSD1306 /home/riviera/Arduino/libraries/Adafruit_TouchScreen /home/riviera/Arduino/libraries/Adafruit_TSC2007 /home/riviera/Arduino/libraries/Servo /home/riviera/Arduino/libraries/Button
BOARD = wifiduino
ARDUINO_LIB_PATH = /usr/share/arduino/lib # I think...
ARDMK_VENDOR = esp8266com
MONITOR_PORT = /dev/ttyUSB0
ESP_ROOT = /usr/share/arduino/hardware/esp8266com/esp8266/
BUILD_ROOT = /home/riviera/Arduino/puzzling_printers/printer_jam/build
include /home/riviera/Applications/makeEspArduino/makeEspArduino.mk

@ -0,0 +1,11 @@
p1 $ slow 0.5
$ action "f!8 b!8"
# device "stepper"
# steps 10
# rpm 20
# mode 3
p2 $ action "f b"
# speed 200
# device "black"
# motor "feed"

@ -120,7 +120,7 @@ void setup() {
stepper->step(stepperSteps, BACKWARD, stepperType);
} else if (address == "/stepper/r") {
stepper->release();
} else if (address == "/stepper/type") {
} else if (address == "/stepper/mode") {
stepperType = m.arg<int>(0);
Serial.print("setting step type to");
Serial.println(stepperType);

Loading…
Cancel
Save