HELP here

Hello, people with actual functional brains!

I have an exam next week so I'm writing my exercises on paper, yet some of them I still wasn't able to solve and can't find any useful resources that can help me (or, most likely, I'm too dumb to know exacly what to search for) so here I am asking for help on a desperate attempt to understand this.

I'm facing two issues with this particular exercise:

First and mainly, I'm suppose to add up to 10 more class Ponto objects;

Second, the fill on the objects is suppose to change according to mouseY coordinate (value must be its half, but it remains black).

Thanks in advance!!

I'm sorry about all this drama. My skull feels like a train wreck from all this stress. Also, as you may guess, english isn't my first language either.


int nPontos=20;

Ponto [] tab=new Ponto[nPontos];

void setup() {

size(500, 500);

for (int i=0; i<nPontos; i++) {

tab[i]=new Ponto(random(50, width-50), random(50, height-50), random(25, 50));



void draw() {


fill(dist(0, mouseY/2, height, width), dist(0, mouseY/2, height, width), dist(0, mouseY/2, height, width));

for (int i=0; i<10; i++) {




void mousePressed() {

// ? ? ? ? ? ? //



class Ponto {

float x, y, r;

Ponto (float _x, float _y, float _r) {





void display() {

ellipse(x, y, 2*r, 2*r);


void setPos(float x1, float y1){




submitted by /u/makowla
[link] [comments]

Issue with Arduino

Hello! This might be quite a long post, but I tried searching for a solution and couldn't find really anything regarding it.

I am trying to run a Processing sketch with my Arduino. I got it a few days ago, so I'm pretty much a noob. I made two similar sketches - one in Arduino and one in Processing. The Arduino one does work, while the Processing sketch doesn't, even though when running the Processing one, the RX lights up on the board.

I have connected an LED into the D9 on the board, with a 220 ohm resistor, and plugged the other leg into the GND. I then proceeded to run the Arduino sketch, which is a simple one, it lights up and down the LED for a second. This one worked.

I then tried running the Processing sketch, exact same code ( adapted for Processing ) using the library for Arduino, and the board seems to communicate with my sketch, as the RX is blinking each second on the board ( I tried different intervals of time and they match with the intervals at which the RX blinks ), but the LED does not turn on and off, like it did with the Arduino sketch.

I tried getting only a serial connection between the Arduino, and it worked - I connected a joystick module to the Arduino and sent the X and Y through the serial port, and the Processing sketch received the information through the serial port, so they are, indeed, communicating.

The port used is COM3 and is running at 9600 baud.

This is the Arduino sketch :

void setup() { pinMode(9, OUTPUT); } void loop() { digitalWrite(9, HIGH); delay(1000); digitalWrite(9, LOW); delay(1000); } 

and this is the Processing ( version 3.4 ) sketch :

import processing.serial.*; import cc.arduino.*; Arduino arduino; void setup() { arduino = new Arduino(this, Arduino.list()[0], 9600); arduino.pinMode(9, Arduino.OUTPUT); } void draw() { arduino.digitalWrite(9, Arduino.HIGH); delay(1000); arduino.digitalWrite(9, Arduino.LOW); delay(1000); } 

I see that some people posted Arduino projects here, so maybe I could get some fix to my issue? I feel kinda dumb for not being able to figure it out myself, but there I go...

submitted by /u/hiimsoba
[link] [comments]