Enable running pde from vs code

This commit is contained in:
Dennis Schoepf 2020-09-21 12:03:05 +02:00
parent 039e4758f1
commit a443b5b412
4 changed files with 114 additions and 10 deletions

View file

@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Run Sketch",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"command": "${config:processing.path}",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "dedicated"
},
"args": [
"--force",
"--sketch=${workspaceRoot}",
"--output=${workspaceRoot}/out",
"--run"
],
"windows": {
"type": "process",
"args": [
"--force",
{
"value": "--sketch=${workspaceRoot}",
"quoting": "strong"
},
{
"value": "--output=${workspaceRoot}\\out",
"quoting": "strong"
},
"--run"
]
}
}
]
}

View file

@ -9,17 +9,16 @@ int radius = 0;
void setup() { void setup() {
/* Set up screen */ /* Set up screen */
fullScreen(); fullScreen();
background(255); background(0);
/* Set up communication with arduino */ /* Set up communication with arduino
String portName = Serial.list()[Serial.list().length - 1]; //change index to match your port String portName = Serial.list()[Serial.list().length - 1]; //change index to match your port
arduinoPort = new Serial(this, portName, 9600); arduinoPort = new Serial(this, portName, 9600); */
} }
void draw() { void draw() {
background(255); println("Test");
/* if ( arduinoPort.available() > 0) {
if ( arduinoPort.available() > 0) {
String rec = arduinoPort.readStringUntil('\n'); String rec = arduinoPort.readStringUntil('\n');
if (rec != null) { if (rec != null) {
receivedMessage = rec; receivedMessage = rec;
@ -33,5 +32,5 @@ void draw() {
circle(width / 2, height / 2, radius); circle(width / 2, height / 2, radius);
fill(0); fill(0);
radius += 10; radius += 10; */
} }

View file

@ -0,0 +1,64 @@
import processing.core.*;
import processing.data.*;
import processing.event.*;
import processing.opengl.*;
import processing.serial.*;
import java.util.HashMap;
import java.util.ArrayList;
import java.io.File;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
public class magic_veneer_processing extends PApplet {
Serial arduinoPort;
String receivedMessage;
boolean cameIntoThreshhold = false;
int radius = 0;
public void setup() {
/* Set up screen */
background(0);
/* Set up communication with arduino
String portName = Serial.list()[Serial.list().length - 1]; //change index to match your port
arduinoPort = new Serial(this, portName, 9600); */
}
public void draw() {
println("Test");
/* if ( arduinoPort.available() > 0) {
String rec = arduinoPort.readStringUntil('\n');
if (rec != null) {
receivedMessage = rec;
}
// Check for specific events and act upon them
if (receivedMessage != null && receivedMessage.contains("isWithinThreshhold")) {
cameIntoThreshhold = true;
}
}
circle(width / 2, height / 2, radius);
fill(0);
radius += 10; */
}
public void settings() { fullScreen(); }
static public void main(String[] passedArgs) {
String[] appletArgs = new String[] { "magic_veneer_processing" };
if (passedArgs != null) {
PApplet.main(concat(appletArgs, passedArgs));
} else {
PApplet.main(appletArgs);
}
}
}