Qualcomm Dragonboard 410C With Grove Starter Kit - Using the Arduino Toolchain

Introduction: Qualcomm Dragonboard 410C With Grove Starter Kit - Using the Arduino Toolchain

About: ​M.Sc. in Electrical Engineering in Rochester Institute of Technology at USA and CMO of Embarcados.

After installing Linux Linaro-Alip (To install it, refer to these tutorials, available in Portuguese at Embarcados and in English in Instructables.) and install everything that is required to use the Grove Starter Kit (To install all that is needed for Grove Starter Kit, refer to this tutorial in English in Instructables), we can run our first program using the Arduino toolchain. In this short tutorial we will control a led with a button.

The microcontroller in the Grove Starter Kit will read the button and control the led using its analog output.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Mounting the Hardware

Connect the Button Grove Board to connector A0.

Connect the Led Grove Board to connector D3 and connect an LED to D1 connector at this board.

Step 2: Run the Example

Access the right folder

cd Starter_Kit_for_96Boards/button_led

Take a look at the source code to understand what will happen when you run the code. After pressing the button, the light will change its luminosity by 25%, 50%, 75% and 100%. Access the original file at this link.

* Example using a button to control an LED * Copyright (c) 2016 Linaro Ltd. * SPDX-License-Identifier: BSD-2-Clause */ int led_pin = 3; int button_pin = A0; void setup() { pinMode(led_pin, OUTPUT); pinMode(button_pin, INPUT); } bool last_button = false; int led_state = 0; void loop() { bool button = digitalRead(button_pin); if (last_button != button) { if (button) { led_state = (led_state + 1) % 4; analogWrite(led_pin, led_state * 0x3f); } delay(100); } last_button = button; }

Add the Arduino.mk Makefile file to the same directory

ln -s /usr/share/arduino/Arduino.mk Makefile <br>

Run the Makefile, build and execute the program

make upload reset_stty <br>
-------------------------<br>Arduino.mk Configuration:
- [COMPUTED]           ARDMK_DIR = /usr/share/arduino (relative to Common.mk)
- [AUTODETECTED]       ARDUINO_DIR = /usr/share/arduino 
- [DEFAULT]            ARDUINO_SKETCHBOOK = /home/linaro/sketchbook 
- [BUNDLED]            AVR_TOOLS_DIR = /usr/share/arduino/hardware/tools/avr (in Arduino distribution)
- [COMPUTED]           ARDUINO_LIB_PATH = /usr/share/arduino/libraries (from ARDUINO_DIR)
- [DEFAULT]            ARDUINO_CORE_PATH = /usr/share/arduino/hardware/arduino/cores/arduino 
- [COMPUTED]           ARDUINO_VAR_PATH = /usr/share/arduino/hardware/arduino/variants (from ARDUINO_DIR)
- [COMPUTED]           BOARDS_TXT = /usr/share/arduino/hardware/arduino/boards.txt (from ARDUINO_DIR)
- [DEFAULT]            USER_LIB_PATH = /home/linaro/sketchbook/libraries (in user sketchbook)
- [DEFAULT]            PRE_BUILD_HOOK = pre-build-hook.sh 
- [DEFAULT]            BOARD_TAG = uno 
- [COMPUTED]           OBJDIR = build-uno (from BOARD_TAG)
- [ASSUMED]            MONITOR_BAUDRATE = 9600 
- [DEFAULT]            MCU_FLAG_NAME = mmcu 
- [DEFAULT]            CFLAGS_STD = -std=gnu99 
- [COMPUTED]           DEVICE_PATH = /dev/tty96B0 (from MONITOR_PORT)
- [AUTODETECTED]       Size utility: AVR-aware for enhanced output
- [COMPUTED]           BOOTLOADER_PARENT = /usr/share/arduino/hardware/arduino/bootloaders (from ARDUINO_DIR)
mkdir -p build-uno
make reset
make[1]: Entering directory '/home/linaro/Starter_Kit_for_96Boards/button_led'
/usr/bin/ard-reset-arduino  /dev/tty96B0
make[1]: Leaving directory '/home/linaro/Starter_Kit_for_96Boards/button_led'
make do_upload
make[1]: Entering directory '/home/linaro/Starter_Kit_for_96Boards/button_led'
/usr/share/arduino/hardware/tools/avr/../avrdude -q -V -D -p atmega328p -C /usr/share/arduino/hardware/tools/avr/../avrdude.conf -c arduino -b 115200 -P /dev/tty96B0 \
        -U flash:w:build-uno/button_led.hex:i
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e950f
avrdude: reading input file "build-uno/button_led.hex"
avrdude: writing flash (1480 bytes):
avrdude: 1480 bytes of flash written
avrdude: safemode: Fuses OK (E:00, H:00, L:00)
avrdude done.  Thank you.
make[1]: Leaving directory '/home/linaro/Starter_Kit_for_96Boards/button_led'
for STTYF in 'stty -F' 'stty --file' 'stty -f' 'stty <' ; \
     do $STTYF /dev/tty >/dev/null 2>&1 && break ; \
    done ; \
    $STTYF /dev/tty96B0  hupcl ; \
    (sleep 0.1 2>/dev/null || sleep 1) ; \
    $STTYF /dev/tty96B0 -hupcl

Press the button 4 times.

You'll notice that the LED brigth changes!

Happy Hacking!

Be the First to Share


    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Finish It Already Speed Challenge

      Finish It Already Speed Challenge