まずはwifi-connectから
2026年8月31日月曜日
wioterminal and internet
wioterminal by arduinoIDE2(jpeg,png-sprite)
chap4_jpeg 以下のように変更(チャットくんにきいた)
2026年8月29日土曜日
tinygo wioterminal(blink,button interrup,usb cdc)
tinygo build -target=wioterminal -o wioterminal_blink.uf2 main.go flashうまくいかん
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
- 端末(ターミナル)を開き、デバイスが認識されているか確認します。bash
lsblkコードは注意してご使用ください。 - リストの中に
Arduinoというラベルや、FAT16/FAT32の小さなドライブ(数MB程度)が見つかるか確認します。 - マウントされていない場合は、手動でマウントを試します(例として
/media/arduinoにマウントする場合)。マウントできたら、ファイルマネージャーでbashsudo mkdir -p /media/arduino sudo mount /dev/sdX1 /media/arduino # /dev/sdX1はlsblkで確認したデバイス名に変更コードは注意してご使用ください。/media/arduinoを開いて.uf2ファイルをドラッグ&ドロップまたはコピーします。
sudo apt update
sudo apt install gvfs-backends udisks2
lsblkまたはdmesgコマンドで、接続されたストレージのパス(例:/dev/sdbや/media/...)を確認します。- マウントポイントが
/media/username/Arduinoのように自動割当てされているが中身が見えない場合は、直接cpコマンドで転送を試します。bashcp firmware.uf2 /media/username/Arduino/
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
まずはblinkから行ってみる
import (
"machine"
"time"
)
func main() {
// 内蔵LEDのピン(LED_BUILTIN)を出力モードに設定
led := machine.LED
led.Configure(machine.PinConfig{Mode: machine.PinOutput})
for {
// LEDを点灯
led.High()
time.Sleep(time.Millisecond * 500)
// LEDを消灯
led.Low()
time.Sleep(time.Millisecond * 500)
}
}
----------------------------------------------
package main
import(
"machine"
"time"
)
func main(){
button1 := machine.BUTTON_1
button1.Configure(machine.PinConfig{Mode: machine.PinInput})
led := machine.LED
led.Configure(machine.PinConfig{Mode: machine.PinOutput})
button1.SetInterrupt(machine.PinToggle, func(machine.Pin){
// button1が変化したときledを操作する
led.Set(button1.Get())
})
for {
// simulate heavy work
time.Sleep(1*time.Second)
}
}
--------------------------------------------------------
package main
import (
"bufio"
"fmt"
"os"
"time"
)
func main(){
time.Sleep(2 * time.Second)
fmt.Printf("hello tinygo\r\n")
msg := ""
fmt.Scanf("%s\r\n", &msg)
fmt.Printf("msg: %q\r\n",msg)
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan(){
fmt.Printf("you typed: %s\r\n",scanner.Text())
}
}
2026年8月27日木曜日
wioterminal and grove sht35(I2C)
#include <Wire.h>
#include "Seeed_SHT35.h"
2026年8月26日水曜日
wioterminal and grove hc-sr04ranger(no I2C!)
なんとI2C仕様でなかった grove dht11 と同じだった!
#include "Ultrasonic.h"
tinygo on raspberry pi pico (not picow)
https://github.com/otakakot/sample-tinygo-raspberry-pi-pico
https://github.com/soypat/cyw43439 これは理解できたらpico2wを買いたいが。。。。
2026年8月24日月曜日
mmbasic web-led-controll-server成功
' command lineでOPTION WIFI "Pikara2-91d8e4","090e219cbdbf5"
' つづいて option tcp server port 80
'再設定のためのリセットはoption wifi off,option tcp server 0
ーーーーーーーーーーー WebMite V6.02.01 最小Webサーバーーーーーーーーー
' HTMLファイルを作成
Open "index.html" For Output As #1
Print #1, "<!DOCTYPE html>"
Print #1, "<html>"
Print #1, "<head>"
Print #1, "<meta charset=""UTF-8"">"
Print #1, "<title>WebMite</title>"
Print #1, "</head>"
Print #1, "<body>"
Print #1, "<h1>Hello WebMite!</h1>"
Print #1, "<p>Pico2W WebMite V6.02.01</p>"
Print #1, "</body>"
Print #1, "</html>"
Close #1
' TCPサーバーからの要求を受け取る
WEB TCP INTERRUPT WebInterrupt
Print "Web server started"
Print "IP address = "; MM.INFO(IP ADDRESS)
Do
Pause 1000
Loop
' HTTPリクエスト処理
Sub WebInterrupt
Local a%, p%, t%
Local buff%(4096/8)
For a% = 1 To MM.INFO(MAX CONNECTIONS)
WEB TCP READ a%, buff%()
p% = LINSTR(buff%(), "GET")
t% = LINSTR(buff%(), "HTTP")
If (p% <> 0) And (t% > p%) Then
WEB TRANSMIT PAGE a%, "index.html"
EndIf
Next a%
End Sub
---------最終的にled-on-off-serverは以下のとうり
' ==========================================
' WebMite V6.02.01
' LED ON/OFF Webサーバー
' LED = GP15
' ==========================================
' --- HTMLファイル作成 ---
Open "index.html" For Output As #1
Print #1, "<!DOCTYPE html>"
Print #1, "<html>"ーーーーーーーー
Print #1, "<head>"
Print #1, "<meta charset=""UTF-8"">"
Print #1, "<meta name=""viewport"" content=""width=device-width,initial-scale=1"">"
Print #1, "<title>WebMite LED Control</title>"
Print #1, "</head>"
Print #1, "<body style=""font-family:sans-serif;text-align:center;padding-top:50px"">"
Print #1, "<h1>WebMite LED Control</h1>"
Print #1, "<p>GP15 LED</p>"
Print #1, "<p>"
Print #1, "<a href=""/?cmd=on"">"
Print #1, "<button style=""font-size:24px;padding:15px 30px"">LED ON</button>"
Print #1, "</a>"
Print #1, "</p>"
Print #1, "<p>"
Print #1, "<a href=""/?cmd=off"">"
Print #1, "<button style=""font-size:24px;padding:15px 30px"">LED OFF</button>"
Print #1, "</a>"
Print #1, "</p>"
Print #1, "</body>"
Print #1, "</html>"
Close #1
' --- LED設定 ---
SetPin GP15, DOUT
Pin(GP15) = 0
' --- TCP要求を割り込みで受け取る ---
WEB TCP INTERRUPT WebInterrupt
Print "Web server started"
Print "IP address = "; MM.INFO(IP ADDRESS)
' --- メインループ は、なにもしない---
Do
Pause 1000
Loop
' ==========================================
' HTTPリクエスト処理
' ==========================================
Sub WebInterrupt
Local a%, p%, t%
Local buff%(4096/8)
For a% = 1 To MM.INFO(MAX CONNECTIONS) // connectionごとの処理
WEB TCP READ a%, buff%()
p% = LINSTR(buff%(), "GET")
// LINSTR(buff%(), "GET") は、MMBasicで 文字列配列 buff%() の中から
// "GET" が出てくる位置を探す
t% = LINSTR(buff%(), "HTTP")
// 以上も同様
If (p% <> 0) And (t% > p%) Then
' LED ON
If LINSTR(buff%(), "?cmd=on") <> 0 Then
Pin(GP15) = 1
Print "LED ON"
EndIf
' LED OFF
If LINSTR(buff%(), "?cmd=off") <> 0 Then
Pin(GP15) = 0
Print "LED OFF"
EndIf
' HTMLを送信
WEB TRANSMIT PAGE a%, "index.html" // connection a%へHTMLを送る
EndIf
Next a%
End Sub
2026年8月23日日曜日
tinygo for pico and pico-sdk and pico-examples
cf https://zenn.dev/askua/articles/05e143091c150c :: tinygo for pico
https://gihyo.jp/admin/serial/01/ubuntu-recipe/0684で成功した pico-sdk and pico-sdk-examples
CMakeLists.txt(CMakeの設定ファイル)
cmake_minimum_required(VERSION 3.10)
project(HelloWorld)
add_executable(helloworld main.cpp)
main.cpp(C++のソースコード) [1]
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
mkdir build
cd build
cmake ..
cmake --build .
- 実行コマンド(Linux/Macの場合):
./helloworld
Hello, World! と表示されます。