Skip to content

Commit

Permalink
Added Bar graph LED Blink example
Browse files Browse the repository at this point in the history
  • Loading branch information
VedantParanjape committed Oct 14, 2020
1 parent 36a951a commit fe8d245
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ _deps
*-prefix/

### vscode ###
.vscode/
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Society Of Robotics and Automation
Copyright (c) 2020 Society of Robotics and Automation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 3 additions & 0 deletions blink_bar_graph_led/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/
sdkconfig
sdkconfig.old
7 changes: 7 additions & 0 deletions blink_bar_graph_led/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

set(EXTRA_COMPONENT_DIRS ../components)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(blink_bar_graph_led)
21 changes: 21 additions & 0 deletions blink_bar_graph_led/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Society of Robotics and Automation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Empty file added blink_bar_graph_led/README.md
Empty file.
8 changes: 8 additions & 0 deletions blink_bar_graph_led/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Edit following two lines to set component requirements (see docs)
set(COMPONENT_REQUIRES )
set(COMPONENT_PRIV_REQUIRES )

set(COMPONENT_SRCS "main.c")
set(COMPONENT_ADD_INCLUDEDIRS "")

register_component()
8 changes: 8 additions & 0 deletions blink_bar_graph_led/main/component.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# Main component makefile.
#
# This Makefile can be left empty. By default, it will take the sources in the
# src/ directory, compile them and link them into lib(subdirectory_name).a
# in the build directory. This behaviour is entirely configurable,
# please read the ESP-IDF documents if you need to do this.
#
34 changes: 34 additions & 0 deletions blink_bar_graph_led/main/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "sra_board.h"

void app_main()
{
ESP_ERROR_CHECK(enable_bar_graph());

while(1)
{
for (int i = 0; i < 5; i++)
{
ESP_ERROR_CHECK(set_bar_graph(0xFF));
vTaskDelay(1000 / portTICK_RATE_MS);
ESP_ERROR_CHECK(set_bar_graph(0x00));
vTaskDelay(1000 / portTICK_RATE_MS);
}

uint8_t var = 0x01;

while(1)
{
if (var == 0x00)
{
var = 0x01;
}

ESP_ERROR_CHECK(set_bar_graph(var));
var = var << 1;
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
}

0 comments on commit fe8d245

Please sign in to comment.