This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This sketch is made for communicating between Arduino and Processing using Serial communication. | |
* Mikko Eloholma, Mehackit (CC BY-SA 4.0) | |
* | |
* 1. Connect a sensor to Arduino's analog port and print the values using Serial. | |
* 2. Run this program once Arduino is sending the data already. | |
* 3. The ellipse in the middle of the canvas should react to the sensor-data. | |
* 4. Change the colors of the sketch and use the data for some other purpose! | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tuodaan Processingiin Serial-kirjasto. | |
import processing.serial.*; | |
// Luodaan Serial-tyypin muuttuja "port" ja kokonaislukumuuttuja "num". port on portti, josta informaatio tulee ja | |
// num-muuttujaan tallennetaan Arduinon lähettämä (potentiometrin) arvo. | |
Serial myPort; | |
int num; | |
void setup() { | |
// Luodaan piirtoikkuna, jonka koko on 600 x 600 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* NodeMCU remote servo controller | |
* by Juho @ Mehackit.org | |
*/ | |
// Servo library | |
#include <Servo.h> | |
Servo servo; | |
// WiFi library | |
#include <ESP8266WiFi.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PImage photo; | |
ArrayList<String> cats = new ArrayList<String>(); | |
void setup() { | |
size(500, 500); | |
cats.add("cat_1.jpeg"); // Replace the "cat_x.xxx" names with picture-names that you put into the program folder. | |
// It works best if the pictures are squares (e.g. 500 x 500) so Processing doesn't have to stretch them | |
cats.add("cat_2.jpg"); | |
cats.add("cat_3.jpeg"); | |
cats.add("cat_4.jpg"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This processing-program generates random poems based on the words in a text-file in the program-folder. | |
//In this example, the text-file is called shakespeare.txt. You can add your own txt file to the program-folder and randomize words from that! | |
// Source for Shakespeare texts: http://shakespeare.mit.edu/. | |
// If questions, ask [email protected]. | |
PFont f; | |
String[] lines; | |
String[] words; | |
String[] shakespeare = new String[1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// importataan serial-kirjasto | |
import processing.serial.*; | |
import processing.video.*; | |
Capture video; | |
// luodaan serial-muuttuja ja num, johon tallennetaan luettu arvo | |
Serial myPort; | |
int num; | |
int num2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() | |
{ | |
//initialize serial communications at a 9600 baud rate | |
Serial.begin(9600); | |
} | |
void loop() | |
{ | |
// read and round the value from pin 0 |