/usr/share/fritzing/sketches/core/Fritzing Creator Kit DE+EN/creator-kit-en/Processing/RGB/RGB.pde is in fritzing-data 0.9.3b+dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | import processing.serial.*;
import cc.arduino.*;
Arduino meinArduino;
int potPin=0;
int value;
int redX = 20;
int greenX = 20;
int blueX = 20;
int redPin = 9;
int greenPin = 10;
int bluePin = 11;
int oldGreen;
int oldRed;
int oldBlue;
void setup() {
size(255,300,P3D);
println(Serial.list()); // List all the available serial ports:
meinArduino = new Arduino(this, Arduino.list()[4], 57600);
noStroke();
}
void graphics(int theValue){
colorMode(RGB,255);
background(0);
fill(100);
rect(0,20,width,20);
rect(0,60,width,20);
rect(0,100,width,20);
fill(255,0,0); rect(0,20,redX,20);
fill(0,255,0); rect(0,60,greenX,20);
fill(0,0,255); rect(0,100,blueX,20);
colorMode(HSB, 100);
fill(value,100,100);
rect(0,160,width,height);
}
void draw(){
value=meinArduino.analogRead(potPin);
value=(int)map(value,0,1023,0,100);
if (mousePressed==true){
if ((mouseX>0)&&(mouseX<=width)){
if ((mouseY>20)&&(mouseY<40)) {
redX = mouseX;
}
if ((mouseY>60)&&(mouseY<80)) {
greenX = mouseX;
}
if ((mouseY>100)&&(mouseY<120)) {
blueX = mouseX;
}
}
}
graphics(value);
if (redX!=oldRed){
meinArduino.analogWrite(redPin,redX);
oldRed=redX;
}
if (greenX!=oldGreen){
meinArduino.analogWrite(greenPin,greenX);
oldGreen=greenX;
}
if (blueX!=oldBlue){
meinArduino.analogWrite(bluePin,blueX);
oldBlue=blueX;
}
}
|