am I an idiot? if and while statements
in
Programming Questions
•
1 year ago
so I have been playing w/ arduinos for a few weeks now, and I am tackling processing as my next step, and it is kicking my butt. As a "hello world" of graphics, i decided to draw a rectangle that gets bigger and smaller (end goal is bar graph that shows some arduino output). However using IF statments I get rectangle that only grows or shrinks, as if it never hits the if limits. if I use a while statment, I get a blank window which I can not close. is it my code? am I insane? what am I missing?
I have run a few pieces of example code and they seem to work fine on my laptop.
- int[] RCTime = {1800, 1500};
- // RCTime[0] = 1800;
- // RCTime[1] = 1500;
- int i=6;
- void setup(){
- size(300,500);
- }
- void draw(){
- background(255);
- fill(0);
- rectMode(CENTER);
- if(i < 4){
- RCTime[1]=RCTime[1]+25;
- rect(150,250,30,RCTime[1]/10);
- i=i++;
- }
- if(i>2){
- RCTime[1]=RCTime[1]-25;
- rect(150,250,30,RCTime[1]/10);
- i=i--;
- }
- }
I have run a few pieces of example code and they seem to work fine on my laptop.
1