raspberry pi pico RC car servo

import timeimport networkimport socketfrom machine import Pin, PWM pwm_f_r = PWM(Pin(15), freq=50)pwm_f_l = PWM(Pin(16), freq=50)pwm_b_r = PWM(Pin(10), freq=50)pwm_b_l = PWM(Pin(21), freq=50) #stopduty_r_stop = int(65535 * 0)duty_l_stop = …

Raspberry pi pico WiFi PWM

import time import network import socket from machine import Pin, PWM pwm = PWM(Pin(16), freq=500) duty = 0 def connect_to_wifi(ssid, password): wlan = network.WLAN(network.STA_IF) wlan.active(True) wlan.connect(ssid, password) max_wait = …

CMakeLists.txt_blink

cmake_minimum_required(VERSION 3.13) include(pico_sdk_import.cmake) project(test_project C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) pico_sdk_init() add_executable(blink src/main.cpp) target_link_libraries(blink pico_std…

blink.cpp_src_pico

/** * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. * * SPDX-License-Identifier: BSD-3-Clause */ #include "pico/stdlib.h" int main() { #ifndef PICO_DEFAULT_LED_PIN #warning blink example requires a board with a regular LED #else const uin…

Motion Detect with Gyro sensor

#define SV_Motor_x_PIN 32 #define SV_Motor_y_PIN 26 #define SV_Motor_z_PIN 14 #include<math.h> #define Deg2rad 3.1415 /180 #include <MadgwickAHRS.h> //MPU9250 #include <Wire.h> const int MPU_addr=0x68; // I2C address of the MPU-6050 int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ,Mg</wire.h></madgwickahrs.h></math.h>…

DIY RC : Simple Structure Air Plane

#include "BluetoothSerial.h" #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it #endif #define Brushless_Motor_PIN 25 #define SV_Motor_PIN 32…

DIY Drone - ESP32 [Version 2] #4 (How to detect Drone angle) Source code

#include "BluetoothSerial.h" #include<math.h> #define Deg2rad 3.1415 /180 #include <MadgwickAHRS.h> //MPU9250関連 #include <Wire.h> const int MPU_addr=0x68; // I2C address of the MPU-6050 int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ,MgX,MgY,MgZ; //取得データの実単位化スケールファ</wire.h></madgwickahrs.h></math.h>…

DIY Drone - ESP32 [Version 2] #3 (How to control Brushless Motor) Source code

Receiver side #include "BluetoothSerial.h" #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it #endif #define Brushless_Motor_PIN 25 int i = 0…

DIY Drone - ESP32 [Version 2] #2 (How to connect ESP32 to ESP32 by Bluetooth) Source Code

Check MACadd void setup(void) { Serial.begin(115200); Serial.println("-----------------"); uint8_t macBT[6]; esp_read_mac(macBT, ESP_MAC_BT); } void loop() { uint8_t macBT[6]; esp_read_mac(macBT, ESP_MAC_BT); Serial.printf("%02X:%02X:%02X:…

DIY Drone - ESP32 [Version 2] #1 (How to make Joystick Controller) Source Code

//ref. https://101010.fun/iot/esp32-joystick.html //ref. https://wak-tech.com/archives/742 #define Right_VRX_PIN 12 #define Right_VRY_PIN 13 #define Left_VRX_PIN 25 #define Left_VRY_PIN 26 int left_x_val; int left_y_val; int right_x_val; i…

DIY RC Bowling [ESP32 ] Source code

Bowl side source code //参考https://rikoubou.hatenablog.com/entry/2017/10/06/181805 #include <WiFi.h> #include <WiFiUdp.h> #include "esp_system.h" const char ssid[] = "ESP32_wifi"; // SSID const char pass[] = "esp32pass"; // password const int localPort = 10</wifiudp.h></wifi.h>…

Source Code of DIY Drone - ESP32 [Arduino] Source code

Drone side source code //参考https://rikoubou.hatenablog.com/entry/2017/10/06/181805 #include<math.h> #define Deg2rad 3.1415 /180 #include <MadgwickAHRS.h> Madgwick MadgwickFilter; float quat[4] = {1.0, 0.0, 0.0 ,0.0}; float rate[3]; ///タイマー割込み 参考https:/</madgwickahrs.h></math.h>…