set arduinoPort1 to "/dev/cu.usbserial-DA01LZ5L" set arduinoPort2 to "/dev/cu.usbserial-DA01LL8E" set arduino1 to serialport open arduinoPort1 bps rate 9600 data bits 8 parity 0 stop bits 1 handshake 0 if arduino1 is equal to -1 then display dialog " could not open port (RFID KEEP CONNECT ERROR) " end if --port 1 connect and test set arduino2 to serialport open arduinoPort2 bps rate 9600 data bits 8 parity 0 stop bits 1 handshake 0 if arduino2 is equal to -1 then display dialog " could not open port (CAP REST CONNECT ERROR) " --port 2 connect and test else repeat 60 times --seconds times set x to serialport read arduino1 if x is equal to "A" then tell application "Spotify" to playpause delay 1 end if end repeat repeat set z to serialport read arduino2 if z is equal to "G" then set volume output volume 10 set volume output volume 5 set volume output volume 0 delay 0 end if if z is equal to "FG" then set volume output volume 20 set volume output volume 25 set volume output volume 20 delay 0 end if if z is equal to "EFG" then set volume output volume 30 set volume output volume 35 set volume output volume 40 delay 0 end if if z is equal to "DEFG" then set volume output volume 50 set volume output volume 55 set volume output volume 60 delay 0 end if if z is equal to "CDEFG" then set volume output volume 70 set volume output volume 75 set volume output volume 80 delay 0 end if if z is equal to "BCDEFG" then set volume output volume 90 set volume output volume 95 set volume output volume 100 delay 0 end if end repeat end if end end
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)