# Issue communicating with Arduino

**URL:** <https://discourse.processing.org/t/issue-communicating-with-arduino/7847>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [January 25, 2019, 9:01pm UTC](https://discourse.processing.org/t/issue-communicating-with-arduino/7847 "2019-01-25T21:01:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan12](https://avatars.discourse-cdn.com/v4/letter/r/50afbb/32.png) [@Ryan12](https://discourse.processing.org/u/Ryan12)\
**Post date:** [January 25, 2019, 9:01pm UTC](https://discourse.processing.org/t/issue-communicating-with-arduino/7847/1 "2019-01-25T21:01:44Z")

</div>

I have a phototransistor and an LED, when I test in Arduino I do get readings from the phototransistor, but when trying to get the same readings in Processing I just get continuous 0’s. Can any one help? I’ve placed the code below. The phototransistor is connected to port A1. Thanks!

```auto
import cc.arduino.*;
import org.firmata.*;
import processing.serial.*;

int PhotoPin1 = 1;
Arduino port;
float W= 0;
void setup(){
port= new Arduino(this, Arduino.list()[17], 9600);
port.pinMode(PhotoPin1, Arduino.INPUT);
}

void draw() {

float w_sensorRaw1= port.analogRead(PhotoPin1);
println(w_sensorRaw1);
println(W);
delay(1000);
}

```

---

<div class="post-metadata">

**Author:** ![Dennis](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dennis/32/1111_2.png) [@Dennis](https://discourse.processing.org/u/Dennis)\
**Post date:** [January 26, 2019, 12:54pm UTC](https://discourse.processing.org/t/issue-communicating-with-arduino/7847/2 "2019-01-26T12:54:06Z")

</div>

Hi, try to assign float var in that way:

```auto
float W = 0.0;

```

This syntax force the compiler to use a float value…

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [January 28, 2019, 5:36am UTC](https://discourse.processing.org/t/issue-communicating-with-arduino/7847/3 "2019-01-28T05:36:00Z")

</div>

Please don’t create duplicate posts.

Continue discussion here: [https://discourse.processing.org/t/issue-with-reading-arduino-port/7846](https://discourse.processing.org/t/issue-with-reading-arduino-port/7846)

Kf
