NodeMCUs

I suggest you hardcode max values first to make sure servos move:

pwm.setPWM(0, 4096, 0);
pwm.setPWM(4,4096, 0);
2 Likes

Thank you for so much for the help.

I’ve changed the force value line to: forceValue= String(map(fsrReading, 0, 1023, 0, 600));
and I am now getting:

From pressure1:

Number of args received:1
Arg n0–> 1f: 1

closing connection
Analog reading = 3
1
connecting to 192.168.4.1
HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 43
Connection: close

From pressure2:

Number of args received:1
Arg n0–> 1f: 2

closing connection
Analog reading = 5
2
connecting to 192.168.4.1
HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 43
Connection: close

Is that any better?

Yes, the sensors are connected to a0.

When I run the sensor value code on the pressure sensors, I get a varying range of approx. 5 up to 1023. Is that correct? Or do I need to change the resistor?

Thanks,
Dani

1 Like

Hi Dani,

the range you get when running the sensorValue code (between 5 and 1023) is good and means the resistor value is also good. It should work nicely with the client code you have.

However, the printout you posted still shows very low values. There is a 3 and a 5. What happens if you press the sensor for a bit like you do when you get a 1023 with the other code? You should see 600 instead of 3 or 5.

Have you tried what @dsikar suggested? If you hardcode pwm.setPWM(0, 0, 600); and pwm.setPWM(4, 0, 600); you should definitely get a reaction (unless there is a hardware problem somewhere).

What will happen though is that the servos will move to a certain position and then stay there. But at least they should react (well, unless they are already in that position…).

Anyway, I think at this point the best thing to do would be to meet in person.

Let me also add that an http GET request in my opinion is not the most efficient way of sending a stream of values from a sender to a receiver. I would normally use OSC for this kind of things.

Michele

1 Like

Dani did you get this all sorted in the end ?

1 Like

Hey! Yeah, Michele Panegrossi helped me write some more code for it and we got it working

3 Likes