02-20-2023 12:07 PM
Hello !
I am trying to make a little project and i just bought a arduino board UNO R3 and a photoelectric sensor. I tried to make a program for the sensor but it didnt work out and i cant find the problem… Can anyone help me, please?
Solved! Go to Solution.
02-20-2023 11:16 PM
@Bianca-Alexandra wrote:
Hello !
I am trying to make a little project and i just bought a arduino board UNO R3 and a photoelectric sensor. I tried to make a program for the sensor but it didnt work out and i cant find the problem… Can anyone help me, please?
Hello and welcome, best bet for getting help is to post your code, that way everyone can read and understand what is going on. Also be explicit on what you are trying to do and what did not work. If you do that we can have you up and running in no time.
02-20-2023 11:24 PM
How have you connected your photo sensor?
Typically, you create a potential divider with the photo sensor and a resistor, connect the junction to analog input of Arduino, and then use the Read Analog function of LINX to get the analog voltage.
02-23-2023 02:58 AM
Hello!
Well i didn’t knew that i need also a resistor…
My connection looks like this, and this is my program
You say that instead i should move to Analog the black wire and do this also in program? There is a chance of doing the program without the resistor?
02-23-2023 03:11 AM
so this is the code in lab view and all i did on the arduino board was to connect the brown wire to 5V, the blue to GND and the black one to Digital 7 . And i tried to upload the code but nothing happened...
02-23-2023 03:14 AM
Ohh, what im trying to do is just to test it for now cause i have a big project to do until end of june ... I just want to understand how is working and until now is not a succes for me
02-23-2023 03:15 AM
better picture of the code
thx 😘
02-23-2023 03:19 AM - edited 02-23-2023 03:23 AM
Hi Bianca,
@Bianca-Alexandra wrote:
My connection looks like this, and this is my program
You still don't provide a lot of information…
@Bianca-Alexandra wrote:
all i did on the arduino board was to connect the brown wire to 5V, the blue to GND and the black one to Digital 7 .
This information is nonsense! How should we know what the colors actually mean?
Which sensor do you use? Mind to share specs/part numbers?
@Bianca-Alexandra wrote:
better picture of the code
You didn't attach "your program", but you attached "an image of the block diagram of your VI": we cannot edit/debug/run images in LabVIEW!
(You also don't care about using AutoCleanup…)
Btw. do you know you can edit your message (within a short period of time) instead of posting 4 messages in a row?
02-23-2023 03:43 AM
What's worse than a picture of code, is a picture of a screen with the code...
I have no experience with LINX, but by quick reading the documentation here are some possible solutions:
- Digital Read function requires you to Set Digital Pin Mode first (according to this)
- Did you load the LINX Firmware to the Arduino?
- As santo_13 pointed out, make sure that you have the sensor connected correctly (and that the sensor actually works)
- Are you sure you need digital read for this? This kind of sensors usually output analog values, so the better choice would be Analog Read function (and connect it to the appropriate pins on Arduino)