Hello I’m trying to send data from my Wemos D1 module (ESP8266 based) to Sonic pi thru OSC.
I found an example on the help files of Sonic Pi for a local osc receving package.
And I have code I thought would work on the ESP8266 to send the data to Sonic Pi.
This is the code for Sonic Pi
live_loop :foo do use_real_time a, b, c = sync "/osc/trigger/prophet" synth :prophet, note: a, cutoff: b, sustain: c end
And this is the code on the Module
/***************************************************
This is a library for the Si1145 UV/IR/Visible Light SensorDesigned specifically to work with the Si1145 sensor in the
adafruit shop
----> SI1145 Digital UV Index / IR / Visible Light Sensor : ID 1777 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kitsThese sensors use I2C to communicate, 2 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
#if defined(ESP8266)
#include <ESP8266WiFi.h>
#else
#include <WiFi.h>
#endif
#include <WiFiUdp.h>
#include <OSCMessage.h>
#include <Wire.h>
#include “Adafruit_SI1145.h”char ssid = “name”; // your network SSID (name)
char pass = “pass”; // your network passwordWiFiUDP Udp; // A UDP instance to let us send and receive packets over UDP
const IPAddress outIp(192,168,0,202); // remote IP of your computer
const unsigned int outPort = 4559; // remote port to receive OSC
const unsigned int localPort = 8888; // local port to listen for OSC packets (actually not used for sending)Adafruit_SI1145 uv = Adafruit_SI1145();
void setup() {
Serial.begin(115200);// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, pass);while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); Serial.println("Starting UDP"); Udp.begin(localPort); Serial.print("Local port: ");
#ifdef ESP32
Serial.println(localPort);
#else
Serial.println(Udp.localPort());
#endifSerial.println(“Adafruit SI1145 test”);
if (! uv.begin()) {
Serial.println(“Didn’t find Si1145”);
while (1);
}Serial.println(“OK!”);
}void loop() {
Serial.println(“===================”);
Serial.print("Vis: "); Serial.println(uv.readVisible());
Serial.print("IR: "); Serial.println(uv.readIR());// Uncomment if you have an IR LED attached to LED pin!
//Serial.print("Prox: "); Serial.println(uv.readProx());float UVindex = uv.readUV();
// the index is multiplied by 100 so to get the
// integer index, divide by 100!
UVindex /= 100.0;
Serial.print("UV: "); Serial.println(UVindex);
OSCMessage msg(“trigger/prophet”);
msg.add(“uv.readVisible, uv.readIR, UVindex”);
Udp.beginPacket(outIp, outPort);
msg.send(Udp);
Udp.endPacket();
msg.empty();
delay(1000);
}
I see nothing appearing on the sonic pi. And the wemos is giving values in the serial terminal.
So my guess something is not being send or received obviously.