# Arduino who help me

**URL:** <https://discourse.processing.org/t/arduino-who-help-me/44207>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [April 2, 2024, 8:35am UTC](https://discourse.processing.org/t/arduino-who-help-me/44207 "2024-04-02T08:35:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![r0x15](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@r0x15](https://discourse.processing.org/u/r0x15)\
**Post date:** [April 2, 2024, 8:35am UTC](https://discourse.processing.org/t/arduino-who-help-me/44207/1 "2024-04-02T08:35:54Z")

</div>

Hello, I should ask something about arduino then I have a variable that goes from zero to 100 and I would like when it arrives at a certain imposed value a certain value raises a Pin. Who explane me  
Thankyou

---

<div class="post-metadata">

**Author:** ![RichardDL](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@RichardDL](https://discourse.processing.org/u/RichardDL)\
**Post date:** [April 2, 2024, 6:53pm UTC](https://discourse.processing.org/t/arduino-who-help-me/44207/2 "2024-04-02T18:53:31Z")

</div>

Hi @r0x15, This has a variable that ramps up to 100 repeatedly, switches the led on if greater than 50. Not sure if you want the led set on/off each time, or only as it goes through 50. Anyway this should get you started. (It compiles, but not tested as don’t have an Arduino with me today.)

```auto
int led = 13;
int count;

void setup() {
  pinMode(led, OUTPUT);
}

void loop() {
  if (count > 50) {
    digitalWrite(led, HIGH);
  } else {
    digitalWrite(led, LOW);
  }
  
  delay(100);
  count++;
  count = count % 100;
}

```

---

<div class="post-metadata">

**Author:** ![r0x15](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@r0x15](https://discourse.processing.org/u/r0x15)\
**Post date:** [April 2, 2024, 7:04pm UTC](https://discourse.processing.org/t/arduino-who-help-me/44207/3 "2024-04-02T19:04:56Z")

</div>

Hi RicharDL  
Thank you for your reply  
No, I just have to set let’s say a scale from 0 to 100, if I set 20 from 0 to 20 the led is on above 20 up to 100 it stays off

Ciao RicharDL  
Grazie per la risposta  
No devo solo impostare ammettiamo una scala da 0 a 100, se imposto 20 da 0 a 20 il led è acceso sopra 20 fino a 100 rimane spento

---

<div class="post-metadata">

**Author:** ![RichardDL](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@RichardDL](https://discourse.processing.org/u/RichardDL)\
**Post date:** [April 3, 2024, 8:16pm UTC](https://discourse.processing.org/t/arduino-who-help-me/44207/4 "2024-04-03T20:16:56Z")

</div>

Hi @r0x15, I’m not clear what the problem is. You want the led action reversed? You could swap ‘High’ and ‘Low’, or you could change ‘\> 50’ to ‘\<50’. You can adjust the numbers to suit.

You can look at the examples, in Processing, File, Examples, Basics, Controls, Conditionals. (Not the most exciting examples, but good use of conditionals.) Similarly in the Arduino IDE, File Examples, Basics, Digital there is Button, DigitalInputPullup, and StateChangeDetection. With all those examples of logic you should have the tools to do whatever you want.
