|
@@ -0,0 +1,64 @@
|
|
|
+#include <Arduino.h>
|
|
|
+
|
|
|
+#include <Automaton.h>
|
|
|
+#include "Atm_lien/Atm_stepper.h"
|
|
|
+#include "Atm_lien/Atm_TeensyStep.h"
|
|
|
+
|
|
|
+#include <SPI.h>
|
|
|
+#include <Ethernet.h>
|
|
|
+#include <EthernetUdp.h>
|
|
|
+#include <TeensyMAC.h>
|
|
|
+#include <OSCMessage.h>
|
|
|
+
|
|
|
+// Enter a MAC address and IP address for your controller below.
|
|
|
+// The IP address will be dependent on your local network:
|
|
|
+byte mac[] = {
|
|
|
+ 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
|
|
|
+};
|
|
|
+
|
|
|
+IPAddress ip(192, 168, 1, 204); //local IP of Arduino/Teensy
|
|
|
+//unsigned int localPort = 8888; // local port to listen on (not needed for multicast)
|
|
|
+
|
|
|
+IPAddress ipMulti(239, 200, 200, 200); // ipMidi Multicast address
|
|
|
+unsigned int portMulti = 9977; // ipMidi Mutlicast port 1
|
|
|
+
|
|
|
+
|
|
|
+// buffers for receiving and sending data
|
|
|
+byte packetBuffer[UDP_TX_PACKET_MAX_SIZE]; // buffer to hold incoming packet
|
|
|
+byte sendBuffer1[] = {0x90, 0x14, 0x22}; // MIDI Note On to Multicast address
|
|
|
+byte sendBuffer2[] = {0x80, 0x14, 0x00}; // MIDI Note Off to Multicast address
|
|
|
+
|
|
|
+// An EthernetUDP instance to let us send and receive packets over UDP
|
|
|
+EthernetUDP Udp;
|
|
|
+
|
|
|
+// Atm_stepper stepper;
|
|
|
+Atm_TeensyStep stepper;
|
|
|
+Stepper A_stepper(22, 21);
|
|
|
+StepControl controller ;
|
|
|
+
|
|
|
+void setup() {
|
|
|
+ //Configure and start ethernet module (not needed for feeder)
|
|
|
+ //SPI.setSCK(27);
|
|
|
+ // Ethernet.init(15);//(10)
|
|
|
+ // teensyMAC(mac);
|
|
|
+ // Ethernet.begin(mac, ip); // start the Ethernet and UDP:
|
|
|
+ // // Udp.beginMulti(ipMulti, portMulti); // for modified Arduino library
|
|
|
+ // Udp.beginMulticast(ipMulti, portMulti); // for modified Teensy Ethernet library
|
|
|
+
|
|
|
+ //Start serial
|
|
|
+ Serial.begin(115200); // higher Baud rate for faster refresh, CHANGE IN SERIAL MONITOR
|
|
|
+ delay(2000);
|
|
|
+ Serial.println("Started");
|
|
|
+
|
|
|
+ stepper.trace( Serial );
|
|
|
+ stepper.begin(A_stepper, controller);
|
|
|
+ //stepper.cycle(1000);
|
|
|
+ stepper.gotoStep(10000);
|
|
|
+ //controller.moveAsync(*stepper.motor);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+void loop() {
|
|
|
+ automaton.run();
|
|
|
+
|
|
|
+}
|