diff --git a/Arduino/README.md b/Arduino/README.md index 45f929c..648d404 100644 --- a/Arduino/README.md +++ b/Arduino/README.md @@ -3,8 +3,12 @@ ## Boards + Arduino Mega 2560 ++ Arduino Micro Pro (atmega32u4) ### PinOUT Arduino Mega 2560 ![pinmap](pinout-arduino-mega.jpg) + +### PinOUT Arduino Micro PRO +![pinmap](arduino_micro.png) diff --git a/Arduino/arduino_micro.png b/Arduino/arduino_micro.png new file mode 100644 index 0000000..4171fd5 Binary files /dev/null and b/Arduino/arduino_micro.png differ diff --git a/ESP32/1499504017768-1pinmap.jpg b/ESP32/1499504017768-1pinmap.jpg new file mode 100644 index 0000000..3120dfc Binary files /dev/null and b/ESP32/1499504017768-1pinmap.jpg differ diff --git a/ESP32/README.md b/ESP32/README.md index e5549e0..2a7c752 100644 --- a/ESP32/README.md +++ b/ESP32/README.md @@ -4,3 +4,8 @@ + MH-ET LIVE + WEMOS R32 + +### Pinout +![pinmap](pinout_ESP32devkitv1.png) + +![pinmap](1499504017768-1pinmap.jpg) diff --git a/ESP32/pinout_ESP32devkitv1.png b/ESP32/pinout_ESP32devkitv1.png new file mode 100644 index 0000000..0d4342a Binary files /dev/null and b/ESP32/pinout_ESP32devkitv1.png differ diff --git a/ESP8266/README.md b/ESP8266/README.md index 8e17759..fdbcd08 100644 --- a/ESP8266/README.md +++ b/ESP8266/README.md @@ -5,3 +5,6 @@ + ESP8266 GENERIC + WEMOS R1 + NodeMCU + +### PinOUT ESP8266 +![pinmap](esp8266-esp12e-pinout.png) diff --git a/ESP8266/esp8266-esp12e-pinout.png b/ESP8266/esp8266-esp12e-pinout.png new file mode 100644 index 0000000..2ec2244 Binary files /dev/null and b/ESP8266/esp8266-esp12e-pinout.png differ diff --git a/PICO/.gitignore b/PICO/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/PICO/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/PICO/I2C_SCANER/.gitignore b/PICO/I2C_SCANER/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/PICO/I2C_SCANER/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/PICO/I2C_SCANER/CMakeLists.txt b/PICO/I2C_SCANER/CMakeLists.txt new file mode 100644 index 0000000..70c16d1 --- /dev/null +++ b/PICO/I2C_SCANER/CMakeLists.txt @@ -0,0 +1,43 @@ +# Generated Cmake Pico project file + +cmake_minimum_required(VERSION 3.13) + +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) + +# initalize pico_sdk from installed location +# (note this can come from environment, CMake cache etc) +set(PICO_SDK_PATH "/home/mdchaparror/linuxTools/pico-sdk") + +# Pull in Pico SDK (must be before project) +include(pico_sdk_import.cmake) + +project(I2C_SCANER C CXX ASM) + +set(PICO_CXX_ENABLE_EXCEPTIONS 1) + +set(PICO_CXX_ENABLE_RTTI 1) + +# Initialise the Pico SDK +pico_sdk_init() + +# Add executable. Default name is the project name, version 0.1 + +add_executable(I2C_SCANER I2C_SCANER.c ) + +pico_set_program_name(I2C_SCANER "I2C_SCANER") +pico_set_program_version(I2C_SCANER "0.1") + +pico_enable_stdio_uart(I2C_SCANER 0) +pico_enable_stdio_usb(I2C_SCANER 1) + +# Add the standard library to the build +target_link_libraries(I2C_SCANER pico_stdlib) + +# Add any user requested libraries +target_link_libraries(I2C_SCANER + hardware_i2c + ) + +pico_add_extra_outputs(I2C_SCANER) + diff --git a/PICO/I2C_SCANER/I2C_SCANER.c b/PICO/I2C_SCANER/I2C_SCANER.c new file mode 100644 index 0000000..d6550e7 --- /dev/null +++ b/PICO/I2C_SCANER/I2C_SCANER.c @@ -0,0 +1,70 @@ +#include +#include "pico/stdlib.h" +#include "hardware/i2c.h" + +// I2C defines +// This example will use I2C0 on GPIO8 (SDA) and GPIO9 (SCL) running at 400KHz. +// Pins can be changed, see the GPIO function select table in the datasheet for information on GPIO assignments +#define I2C_PORT i2c0 +#define I2C_SDA 0 +#define I2C_SCL 1 + +// I2C reserves some addresses for special purposes. We exclude these from the scan. +// These are any addresses of the form 000 0xxx or 111 1xxx +bool reserved_addr(uint8_t addr) +{ + return (addr & 0x78) == 0 || (addr & 0x78) == 0x78; +} + +int main() +{ + stdio_init_all(); + + // I2C Initialisation. Using it at 400Khz. + i2c_init(I2C_PORT, 400 * 1000); + + gpio_set_function(I2C_SDA, GPIO_FUNC_I2C); + gpio_set_function(I2C_SCL, GPIO_FUNC_I2C); + gpio_pull_up(I2C_SDA); + gpio_pull_up(I2C_SCL); + + int error, address; + uint8_t data; + int nDevices; + + sleep_ms(5000); + + while (1) + { + + printf("Escaneando bus I2C\n"); + printf("===================\n"); + + nDevices = 0; + + for (address = 1; address < 127; address++) + { + + if (reserved_addr(address)) + error = PICO_ERROR_GENERIC; + else + error = i2c_read_blocking(I2C_PORT, address, &data, 1, false); + + if (error >= 0) + { + printf("Dispositivo I2C encontrado en 0x%02x \n", address); + nDevices = nDevices + 1; + } + } + printf("Encontrados %2x dispositivos I2C\n", nDevices); + printf("===================\n"); + printf("\n"); + printf("\n"); + printf("\n"); + printf("\n"); + + sleep_ms(5000); + } + + return 0; +} diff --git a/PICO/I2C_SCANER/pico_sdk_import.cmake b/PICO/I2C_SCANER/pico_sdk_import.cmake new file mode 100644 index 0000000..28efe9e --- /dev/null +++ b/PICO/I2C_SCANER/pico_sdk_import.cmake @@ -0,0 +1,62 @@ +# This is a copy of /external/pico_sdk_import.cmake + +# This can be dropped into an external project to help locate this SDK +# It should be include()ed prior to project() + +if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) + set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) + message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") +endif () + +if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) + set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) + message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") +endif () + +if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) + set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) + message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") +endif () + +set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") +set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") +set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") + +if (NOT PICO_SDK_PATH) + if (PICO_SDK_FETCH_FROM_GIT) + include(FetchContent) + set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) + if (PICO_SDK_FETCH_FROM_GIT_PATH) + get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") + endif () + FetchContent_Declare( + pico_sdk + GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk + GIT_TAG master + ) + if (NOT pico_sdk) + message("Downloading Raspberry Pi Pico SDK") + FetchContent_Populate(pico_sdk) + set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) + endif () + set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) + else () + message(FATAL_ERROR + "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." + ) + endif () +endif () + +get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") +if (NOT EXISTS ${PICO_SDK_PATH}) + message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") +endif () + +set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) +if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) + message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") +endif () + +set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) + +include(${PICO_SDK_INIT_CMAKE_FILE}) diff --git a/PICO/README.md b/PICO/README.md new file mode 100644 index 0000000..3e6deda --- /dev/null +++ b/PICO/README.md @@ -0,0 +1,11 @@ +# PROYECTOS RASPBERRY PICO + +## Boards + ++ RASPBERRY PI PICO + +### PinOUT PICO +![pinmap](Raspberry-Pi-Pico-pinout-diagram.svg) + +### Data +![SDK](data/PICO_C_SDK.pdf) diff --git a/PICO/Raspberry-Pi-Pico-pinout-diagram.svg b/PICO/Raspberry-Pi-Pico-pinout-diagram.svg new file mode 100644 index 0000000..2b09ce3 --- /dev/null +++ b/PICO/Raspberry-Pi-Pico-pinout-diagram.svg @@ -0,0 +1,5457 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PICO/blink/.gitignore b/PICO/blink/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/PICO/blink/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/PICO/blink/CMakeLists.txt b/PICO/blink/CMakeLists.txt new file mode 100644 index 0000000..9276d9d --- /dev/null +++ b/PICO/blink/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.1) + +include(~/linuxTools/pico-sdk/external/pico_sdk_import.cmake) + +project(blink) + +pico_sdk_init() + +add_executable(main + main.c +) + + +pico_add_extra_outputs(main) +target_link_libraries(main pico_stdlib) + diff --git a/PICO/blink/main.c b/PICO/blink/main.c new file mode 100644 index 0000000..8c496e3 --- /dev/null +++ b/PICO/blink/main.c @@ -0,0 +1,16 @@ +#include "pico/stdlib.h" +#include "hardware/gpio.h" + +int main() { + const uint LED_PIN = 25; + gpio_init(LED_PIN); + gpio_set_dir(LED_PIN, GPIO_OUT); + + while (true) { + gpio_put(LED_PIN, 1); + sleep_ms(100); + gpio_put(LED_PIN, 0); + sleep_ms(100); + } + return 0; +} \ No newline at end of file diff --git a/PICO/blink/pico_sdk_init.cmake b/PICO/blink/pico_sdk_init.cmake new file mode 100644 index 0000000..63a80ec --- /dev/null +++ b/PICO/blink/pico_sdk_init.cmake @@ -0,0 +1,62 @@ +# This is a copy of /external/pico_sdk_import.cmake + +# This can be dropped into an external project to help locate this SDK +# It should be include()ed prior to project() + +if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) + set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) + message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") +endif () + +if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) + set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) + message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") +endif () + +if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) + set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) + message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") +endif () + +set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") +set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") +set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") + +if (NOT PICO_SDK_PATH) + if (PICO_SDK_FETCH_FROM_GIT) + include(FetchContent) + set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) + if (PICO_SDK_FETCH_FROM_GIT_PATH) + get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") + endif () + FetchContent_Declare( + pico_sdk + GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk + GIT_TAG master + ) + if (NOT pico_sdk) + message("Downloading Raspberry Pi Pico SDK") + FetchContent_Populate(pico_sdk) + set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) + endif () + set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) + else () + message(FATAL_ERROR + "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." + ) + endif () +endif () + +get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") +if (NOT EXISTS ${PICO_SDK_PATH}) + message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") +endif () + +set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) +if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) + message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") +endif () + +set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) + +include(${PICO_SDK_INIT_CMAKE_FILE}) \ No newline at end of file diff --git a/PICO/data/PICO_C_SDK.pdf b/PICO/data/PICO_C_SDK.pdf new file mode 100644 index 0000000..c077d92 Binary files /dev/null and b/PICO/data/PICO_C_SDK.pdf differ diff --git a/PICO/sensor_temperatura/CMakeLists.txt b/PICO/sensor_temperatura/CMakeLists.txt new file mode 100644 index 0000000..6bfa934 --- /dev/null +++ b/PICO/sensor_temperatura/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.1) + +include(~/linuxTools/pico-sdk/external/pico_sdk_import.cmake) + +project(sensor_temperatura) + +pico_sdk_init() + +add_executable(main + main.c +) + +pico_enable_stdio_usb(main 1) +pico_enable_stdio_uart(main 0) +pico_add_extra_outputs(main) +target_link_libraries(main pico_stdlib hardware_adc) + diff --git a/PICO/sensor_temperatura/main.c b/PICO/sensor_temperatura/main.c new file mode 100644 index 0000000..8d100b3 --- /dev/null +++ b/PICO/sensor_temperatura/main.c @@ -0,0 +1,32 @@ +#include +#include "hardware/gpio.h" +#include "pico/stdlib.h" +#include "hardware/gpio.h" +#include "hardware/adc.h" +#include "pico/binary_info.h" + +const float conv_factor = 3.3f / (1 << 12); + +int main() +{ + stdio_init_all(); + uint16_t lectura; + float lect_conv, temperatura; + + adc_init(); + adc_set_temp_sensor_enabled(true); + adc_select_input(4); // imput 4 - sensor temperatura + + while (true) + { + lectura = adc_read(); + lect_conv = lectura * conv_factor; + temperatura = 27 - (lect_conv - 0.706) / 0.001721; + + // mostrar temperatura + printf("%2.1f\n", temperatura); + + sleep_ms(2000); + } + return 0; +} \ No newline at end of file diff --git a/Texas/README.md b/Texas/README.md index 3eab603..bd8a100 100644 --- a/Texas/README.md +++ b/Texas/README.md @@ -1,4 +1,4 @@ -# PROYECTOS STM32 +# PROYECTOS TEXAS ## Boards