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

Using Grove LED Socke Kit with nrf9160 DK

Hello,

So I have the following setup. I have an nrf9160 DK board. With the following hardware.

A base shield: https://www.reichelt.com/ch/de/arduino-shield-base-shield-v2-ard-shd-base-v2-p191204.html?CTYPE=0&MWSTFREE=0&PROVID=2788&wt_gacha=52160633186_254281990522&PROVID=2788&gclid=EAIaIQobChMI8tqAkNCL6gIVgY2yCh3PXQmCEAQYAiABEgJhpfD_BwE&&r=1

And a LED: https://wiki.seeedstudio.com/Grove-LED_Socket_Kit/

Now I just want to lit up the LED. But it won't work. Can someone help? Are there any samples?

I am able to use the grove light sensor. I tried to bind the led the same way but it does not work.

Thank you.

Kind regards.

Parents
  • Hello,

    can you explain how you set up the hardware and also what code you are running on the nrf9160? There are plenty of samples that use LEDs, like the Zephyr blinky example, but they are configured to use the DK LEDs, so you would likely need to change the GPIO pins to the ones that your board uses.

  • Hi. Thanks for your answer.

    So I have the following overlay file. The grove light and bme sensor are working.

    &i2c2 {
        compatible = "nordic,nrf-twim";
    	status = "okay";
    	sda-pin = < 30 >;
    	scl-pin = < 31 >;
        clock-frequency = <I2C_BITRATE_STANDARD>;  
    	
    	/* The I2C address could be one of two, here 0x76 is assumed */
    	bme280@77 {
    		compatible = "bosch,bme280";
    		reg = <0x77>;
    		label = "BME280";
    	};
    };
    
    / {
    	gls {
    		label = "GLS";
    		compatible = "grove,light";
    		io-channels = <&adc 0>;
    	};
    
        led {
    		label = "LED1";
    		compatible = "grove,led_socket";
    		io-channels = <&adc 1>;
    	};
    
    };

    Now I tried to bind the LED with the following code: 

        struct device *led;
    	led = device_get_binding("LED1");
    
    	if (led == NULL) {
    		printf("led device not found.  aborting test.\n");
    		return;
    	}

    It always prints "led device not found". Do I use the wrong port? 

    Kind regards.

Reply
  • Hi. Thanks for your answer.

    So I have the following overlay file. The grove light and bme sensor are working.

    &i2c2 {
        compatible = "nordic,nrf-twim";
    	status = "okay";
    	sda-pin = < 30 >;
    	scl-pin = < 31 >;
        clock-frequency = <I2C_BITRATE_STANDARD>;  
    	
    	/* The I2C address could be one of two, here 0x76 is assumed */
    	bme280@77 {
    		compatible = "bosch,bme280";
    		reg = <0x77>;
    		label = "BME280";
    	};
    };
    
    / {
    	gls {
    		label = "GLS";
    		compatible = "grove,light";
    		io-channels = <&adc 0>;
    	};
    
        led {
    		label = "LED1";
    		compatible = "grove,led_socket";
    		io-channels = <&adc 1>;
    	};
    
    };

    Now I tried to bind the LED with the following code: 

        struct device *led;
    	led = device_get_binding("LED1");
    
    	if (led == NULL) {
    		printf("led device not found.  aborting test.\n");
    		return;
    	}

    It always prints "led device not found". Do I use the wrong port? 

    Kind regards.

Children
Related