This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Simple Flashing LED code

Hi there

I am trying to write a simple code that will flash turn on an LED fro one I/O pine of the nrf24le1 in response to an input from another I/O pin of the nrf24le1. Basically, my code is an if loop that will set pin02 to 1 if the value at pin01 is above 1000. If the value falls less than 1000, I want P02 to turn off the LED.

The code this far is written like this:

//Set P0 as output

P0DIR=0x00;

if (P00>=1000)
{
//turn P00 on
P02 = 1;
}else{
P02 = 0;
}

This code is not working. Does anyone have any thoughts on how I should change it? this is my first time ever programming a microcontroller so any help is appreciated :) If you have any thoughts on how I should better figure out/ learn how to program, please let me know (ie. reading documentation, etc).

Thank you!

Emma

Parents
  • Hi Emma

    My first piece of advice would be not to start out with the nRF24LE1, since this chip is very old and not very well supported anymore ;)

    Instead I would recommend a device in the nRF52 family, such as the nRF52840, which has a more modern ARM based architecture, more features and uses less power (if you want to make a battery powered device). 

    And if you are new to microcontrollers it is even easier to start out with something like an Arduino board, such as the Arduino Nano 33 BLE (using the aforementioned nRF52840 chip), or the MicroBit.

    As for your question, a single pin can only ever be 0 or 1. In other words P00 will never be >= 1000 ;)

    Best regards
    Torbjørn

Reply
  • Hi Emma

    My first piece of advice would be not to start out with the nRF24LE1, since this chip is very old and not very well supported anymore ;)

    Instead I would recommend a device in the nRF52 family, such as the nRF52840, which has a more modern ARM based architecture, more features and uses less power (if you want to make a battery powered device). 

    And if you are new to microcontrollers it is even easier to start out with something like an Arduino board, such as the Arduino Nano 33 BLE (using the aforementioned nRF52840 chip), or the MicroBit.

    As for your question, a single pin can only ever be 0 or 1. In other words P00 will never be >= 1000 ;)

    Best regards
    Torbjørn

Children
Related