I use RFID to load an image, the image is a large image that it 10,000x664 pixels. When the image is loaded it loads into a 1000x664 frame and a potentiometer is used to scroll through the image. Also when the image is loaded, a music track starts playing at the same time, but because of the size of the image the song doesn't play smoothly?
Is there any way that I can keep the same sized image, but get the music file to play smoothly? Another place to store other than the data folder maybe ?
I have my Arduino sending Potentiometer and RFID values, the RFID loads the image from the data folder and the potentiometer is there to scroll left and right. Now the RFID is loading the images, but the Potentiometer is moving the image, it did slightly before. I just don't know what I'm missing to make it work, Any suggestions ?
import processing.serial.*;
import ddf.minim.*;//declare
AudioPlayer player;
Minim minim;
int x, moveSpeed = 10;
Serial portOne; // the first serial port
Serial portTwo; // the second serial port
boolean showImage; // whether or not to show the image
portOne = new Serial(this, Serial.list()[16], 9600);
// set both ports to buffer information until you get 0x03:
portOne.bufferUntil('\n');
minim=new Minim(this);
bg = loadImage("backimage.jpg");
}
void draw() {
background(bg);
if(tag!="")
{
getImage(tag,pictureNumber);
image(thisImage, 0, 0);
}
// if there's an image to show, show it:
if (showImage) {
image(thisImage, 0, 0);
float potentiometer = sensorFloat;
float movement = map(potentiometer, 0, 1023, -moveSpeed, moveSpeed); // map from range (0, 1023) to (-moveSpeed, moveSpeed)
x += movement; // add movement to location
x = constrain(x, -(thisImage.width-width), 0); // constrain image by 0 (at the beginning) and -600 (aka a remaining visible image width of 1000 equal to the canvas width).
image(thisImage, x, 0); // draw the image
fill(0);
frame.setTitle(x + ""); // see the x in the top-left
I originally want to map images to values from a potentiometer, but now I just want to scroll left and right in a slideshow using a potentiometer;
The code below, scrolls from right to left showing the different images;
PImage img;
int x,y;
void setup()
{
size(1000,664);
img = loadImage("imagescroll.jpg"); // image is 1600 x 600
}
void draw()
{
// background(0);
// not needed as image is bigger than size
// and thus overwrites all areas
x = constrain(x, 0, img.width - width);
// ensures that "scrolling" stops at right end of image
// y = constrain(y, 0, img.height - height);
// Not needed here, as scolling only in x
image(img, -x, 0);
// overwrites the whole screen with the "shifted" image
x = frameCount;
// advances the image with each new frame
// do whatever is wanted from here on
// like after a call of background();
//stroke(0,0,0);
//ellipse(mouseX,mouseY,15,15);
}
I want to use the values 0 to 1023 I get from using a potentiometer, I want to use the values to select how quickly I scroll through the images and in which direction. Values near 512 stop the scroll, values dropping below 512 would scroll left and values increasing above 512 would scroll right.
Hi, I use an RFID that loads multiple images, and I want to use a potentiometer to scroll through them ? How would I go about that and incorporate it into my code?
If you want to see the code I have, I'll happily post it.