sphere visuals

master
Rob Canning 2023-01-26 10:05:59 +01:00
parent d11aadd03b
commit 1e7cc12bdd
1 changed files with 2 additions and 57 deletions

View File

@ -28,7 +28,6 @@ JSONObject jsonchannel;
JSONArray totalData;
JSONArray nameData;
JSONArray chnameData;
JSONObject record;
int id;
@ -47,18 +46,11 @@ boolean urosDisplayed;
void setup() {
fullScreen(P3D);
colorMode(HSB, 255);
//// CREATE GRAPHICS BUFFER FOR UROS DATA
urosBuffer = createGraphics(600,300);
chickenfoot = loadShape("chicken.obj");
chickenfoot.setFill(color(200, 0, 0));
liberation = createFont("LiberationMono-Bold.ttf", 30);
frameRate(24);
smooth();
// SET OSC LISTEN FROM SUPERCOLLIDER
// SET OSC LISTEN FROM SUPERCOLLIDER
OscProperties properties = new OscProperties();
properties.setListeningPort(47120); // osc receive port (from sc)
oscP5 = new OscP5(this, properties);
@ -79,57 +71,11 @@ void oscEvent(OscMessage msg) {
}
}
// UROS DATA ////////////////////////////////////////
void getUROS() {
// UROS DATA FROM THINGSPEAK
json = loadJSONObject("https://api.thingspeak.com/channels/1724587/feeds.json");
jsonchannel = loadJSONObject("https://api.thingspeak.com/channels/1724587channel.json");
totalData = json.getJSONArray("feeds");
for (int i = 0; i < totalData.size(); i++) {
record = totalData.getJSONObject(i);
id = record.getInt("entry_id");
timeStamp = record.getString("created_at");
temp = int(record.getString("field1"));
co2 = int(record.getString("field3"));
humidity = int(record.getString("field4")); }
}
void urosDrawData() {
//draw data direct to the buffer
//urosBuffer.scale(2);
urosBuffer.beginDraw();
urosBuffer.clear();
//size(222,111);
urosBuffer.background(0,0,0, 0.5);
urosBuffer.noFill();
//urosBuffer.fill(111);
//urosBuffer.rect(0,0, width/5, height/5);
urosBuffer.fill(0);
urosBuffer.textFont(liberation);
urosBuffer.text("Location: " + name, 30, 50);
urosBuffer.text("Time: " + timeStamp, 30, 100);
urosBuffer.text("Temperature (Celsius): " + temp, 30, 150);
urosBuffer.text("CO2 PPM: " + co2, 30, 200);
urosBuffer.text("Humidity (%rel): " + humidity, 30, 250);
urosBuffer.endDraw();
}
void drawTarget(float xloc, float yloc, float size, float num) {
float grayvalues = 255/num;
float steps = size/num;
ellipseMode(CENTER);
for (int i = 0; i < num; i++) {
fill(i*grayvalues);
ellipse(xloc, yloc, size - i*steps, size - i*steps);
}
}
////////////////////////////////////////////////////////
void draw() {
if (y >= 5 ){
if (y < 5 ){
background(255, 0, 0);
stroke(0);
//background(123,44,234);
@ -155,7 +101,6 @@ void draw() {
//lights();
strokeWeight(2);
fill(255);
pushMatrix();