2026年3月29日日曜日

kaluma on ide 未踏あり!

 

kaluma ide on chromeではconnectでピコとつないで左画面のコードがflashで書き込まれた! packageもいけるかどうかは、未踏。。。。
Total: 34 packages
  • npm i https://github.com/niklauslee/7-segment
    Kaluma library for multi-digit 7-segment display (aka. FND - flexible numeric display)
  • npm i https://github.com/niklauslee/active-buzzer
    Kaluma library to generate beep sound with active buzzer
  • npm i https://github.com/rossdoker/bh1750
    Kaluma library for BH1750 light sensor
  • npm i https://github.com/niklauslee/buzzer-music
    Kaluma library to play music with passive buzzer.
  • npm i https://github.com/niklauslee/dht
    Kaluma library for DHT humidity and temperature sensor 成功した!
  • github installしてreadmeの例文をindex.jsにしてkaluma flash ./index.js --bundleして
  • kaluma shell & .load で成功した
  • npm i https://github.com/rossdoker/ds1307
    Kaluma library for DS1307 RTC module
  • npm i https://github.com/niklauslee/esp8266-driver
    ESP8266 network device driver for Kaluma
  • npm i https://github.com/niklauslee/esp8266-http-client
    A simple Kaluma HTTP client library for ESP8266 module
  • npm i https://github.com/niklauslee/hc-sr04
    Kaluma library for HC-SR04 ultrasonic distance measurement module
  • npm i https://github.com/slashinfty/i2c-lcd
    Kaluma library for liquid crystal display with PCF8574 I2C port expander (LCM1602 module)
  • npm i https://github.com/niklauslee/ir-receiver
    Kaluma library for IR (Infra-red) receiver.
  • npm i https://github.com/niklauslee/joystick
    Kaluma library for joystick module
  • npm i https://gitlab.com/kobaj/kaluma-eink
    A library for controlling e-ink and e-paper displays (mostly from Waveshare) with Kaluma and an RP2040.
  • npm i https://github.com/niklauslee/lcd
    Kaluma library for liquid crystal display (HD44780 driver)
  • npm i https://github.com/niklauslee/lm35
    Kaluma library for LM35 temperature sensor
  • npm i https://github.com/AlexK-99/lp50xx
    This is an Kaluma library for interaction with the LP5009 and LP5012 constant current RGB driver from Texas Instrument
  • npm i https://github.com/niklauslee/max7219
    A library for MAX7219/MAX7221 (LED matrix)
  • npm i https://github.com/alexander-daniel/mcp3008
    Kaluma library for MCP3008 8-Channel ADC
  • npm i https://github.com/niklauslee/micro-jest
    A tiny testing framework for Kaluma
  • npm i https://github.com/niklauslee/mpu6050
    Kaluma library for MPU6050 6-axis motion sensor
  • npm i https://github.com/niklauslee/neopixel
    Kaluma library for NeoPixel (ws2812) based on RP2 PIO (Programmable I/O)
  • npm i https://github.com/niklauslee/pcd8544
    Kaluma library for PCD8544, a.k.a Nokia 5110 (Monochrome LCD Display)
  • npm i https://github.com/niklauslee/picosystem
    Kaluma library for Pimoroni's PicoSystem
  • npm i https://github.com/niklauslee/rotary-encoder
    Kaluma library for rotary encoder with a push switch (KY-040)
  • npm i https://github.com/niklauslee/servo
    Kaluma library to control servo motors
  • npm i https://github.com/niklauslee/simple-fonts
    Simple bitmap fonts for Kaluma :: モノクロOLEDでトライ!
  • npm i https://github.com/niklauslee/ssd1306
    Kaluma library for SSD1306 (Monochrome OLED Display)
  • npm i https://github.com/niklauslee/ssd1351
    Kaluma library for SSD1351 (16-bit Color OLED Display)
  • npm i https://github.com/niklauslee/st7735
    Kaluma library for ST7735 (Color TFT LCD Display)
  • npm i https://github.com/niklauslee/st7789
    Kaluma library for ST7789 (Color TFT/IPS LCD Display)
  • npm i https://github.com/niklauslee/stepper
    Kaluma library to control stepper motors
  • npm i https://github.com/niklauslee/tm1637
    Kaluma library for 7-segment LED Display
  • npm i https://github.com/haraldkubota/vl53l0x
    Time-of-Flight Sensor VL53L0X
  • npm i https://github.com/pankleks/picomqtt
    MQTT   一回は成功している。。。。

2026年3月25日水曜日

Raspberry Piをwindows11でSSHするときエラーがでたら/Kaluma on Raspi

Raspberry PiのOS再インストールやSSH鍵の再生成によって、SSHのホストキー(raspberrypi.local)が変更されたため、古い情報が記録されているWindows側のknown_hostsファイルでエラーが発生しています。 信頼できる相手(自分のRaspberry Pi)である場合は、以下のいずれかの方法で解決できます。 方法1:PowerShellで古い鍵を削除する(推奨) Git BashやPowerShellを管理者として開き、以下のコマンドを実行して古いキーを特定・削除します。 powershell ssh-keygen -R raspberrypi.local これで成功した ----------------------------------------------- nodejs,kaluma がらみはsudoが必要(ubuntuではいらんがraspiでは必須)

2026年3月24日火曜日

golangで公開ブローカへpub成功

package main import ( "fmt" "time" mqtt "github.com/eclipse/paho.mqtt.golang" ) func main() { // 1. MQTTブローカーの設定 broker := "tcp://broker.hivemq.com:1883" // 公開ブローカー topic := "fseigojp/test" // smart-appで受信できた clientID := "go_client_pub" // 名前はなんでもよかった opts := mqtt.NewClientOptions() opts.AddBroker(broker) opts.SetClientID(clientID) // 接続ロスト時のハンドラ(オプション) opts.OnConnectionLost = func(c mqtt.Client, err error) { fmt.Printf("Connection lost: %v\n", err) } // 2. クライアントの作成と接続 client := mqtt.NewClient(opts) if token := client.Connect(); token.Wait() && token.Error() != nil { panic(token.Error()) } fmt.Println("Connected to", broker) // 3. メッセージのパブリッシュ payload := fmt.Sprintf("Hello from Go! Time: %s", time.Now().Format(time.RFC3339)) token := client.Publish(topic, 1, false, payload) token.Wait() // 完了を待つ fmt.Printf("Published to %s: %s\n", topic, payload) // 4. クライアントの切断 client.Disconnect(250) fmt.Println("Disconnected") }

2026年3月23日月曜日

golang :wifiLAN内のuno r4 wifiのLED制御 ・ uno r4 wifi 単体でも


 「ArduinoをWebサーバーにする」方法が最も簡単で確実です。Arduino R4 WiFiの標準ライブラリ(WiFiS3)だけで完結

1. Arduino側のコード

以下のスケッチをコピーして、SSIDとパスワードを書き換えて書き込んでください。/led/on で点灯、/led/off で消灯します。

#include "WiFiS3.h"

char ssid[] = "あなたのSSID";

char pass[] = "あなたのパスワード";

WiFiServer server(80);

void setup() {

  pinMode(LED_BUILTIN, OUTPUT);

  Serial.begin(9600);

  WiFi.begin(ssid, pass);

  while (WiFi.status() != WL_CONNECTED) delay(500);

  server.begin();

  Serial.print("IP Address: ");

  Serial.println(WiFi.localIP());

}


void loop() {

  WiFiClient client = server.available();

  if (client) {

    String req = client.readStringUntil('\r');

    if (req.indexOf("GET /led/on") != -1) digitalWrite(LED_BUILTIN, HIGH);

    if (req.indexOf("GET /led/off") != -1) digitalWrite(LED_BUILTIN, LOW);

    client.println("HTTP/1.1 200 OK\n\nOK");

    client.stop();

  }

}

※ 書き込み後、シリアルモニタに表示される IPアドレス をメモしてください。

2. Go言語側のコード

Goからは標準の http パッケージを使って、ArduinoのURLを叩くだけです。

package main

import (

"fmt"

"net/http"

"time"

)


func main() {

// ArduinoのIPアドレスに書き換えてください

baseURL := "http://192.168.x.x"

for {

// LED ON

fmt.Println("LED ON")

http.Get(baseURL + "/led/on")

time.Sleep(1 * time.Second)


// LED OFF

fmt.Println("LED OFF")

http.Get(baseURL + "/led/off")

time.Sleep(1 * time.Second)

}

}

コードは注意してご使用ください。


この方法のメリット

ライブラリ不要&安定性: Arduino R4 WiFi公式の WiFiS3 ライブラリを使うため、接続が非常に安定します。

拡張性: ブラウザから http://IPアドレス/led/on と入力するだけでも操作OK

まずは ArduinoのシリアルモニタにIPアドレスが表示されるか 確認してみてください!=>数回unoのリセットをかけんとipが0.0.0.0となる、secrets.h必要?

ーーーーーーーーーーーーーーーーーーーーーーーーー

softapの場合はsecrets.h設定不要だった
#include "WiFiS3.h"

// アクセスポイントの設定
char ssid[] = "UNO-R4-AP"; // 任意のSSID
char pass[] = "password";  // 8文字以上のパスワード
int status = WL_IDLE_STATUS;

WiFiServer server(80); // 80番ポートでサーバーを起動

void setup() {
  Serial.begin(9600);
  pinMode(LED_BUILTIN, OUTPUT);

  // APを作成
  Serial.print("Creating access point named: ");
  Serial.println(ssid);
  status = WiFi.beginAP(ssid, pass);

  if (status != WL_AP_LISTENING) {
    Serial.println("Creating access point failed");
    while (true);
  }

  // サーバー起動
  server.begin();

  // IPアドレス表示
  IPAddress ip = WiFi.localIP();
  Serial.print("AP IP address: ");
  Serial.println(ip);
}

void loop() {
  WiFiClient client = server.available(); // クライアントの接続を待つ

  if (client) {
    Serial.println("new client");
    String currentLine = "";
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        if (c == '\n') {
          if (currentLine.length() == 0) {
            // HTTPレスポンスの送信
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();
            client.print("Click <a href=\"/H\">here</a> to turn the
LED on.<br>");
            client.print("Click <a href=\"/L\">here</a> to turn the
LED off.<br>");
            client.println();
            break;
          } else {
            currentLine = "";
          }
        } else if (c != '\r') {
          currentLine += c;
        }

        // URLによるLED制御
        if (currentLine.endsWith("GET /H")) {
          digitalWrite(LED_BUILTIN, HIGH);
        }
        if (currentLine.endsWith("GET /L")) {
          digitalWrite(LED_BUILTIN, LOW);
        }
      }
    }
    client.stop();
    Serial.println("client disconnected");
  }
}




2026年3月21日土曜日

gobot uno3-builtinLED

scratchino,johnfive同様にuart制御である、ラズパイやesp8266でもOKみたい 

package main

import (

"time"

"gobot.io/x/gobot"

"gobot.io/x/gobot/drivers/gpio"

"gobot.io/x/gobot/platforms/firmata"

)

func main() {

adaptor := firmata.NewAdaptor("COM8")

led := gpio.NewLedDriver(adaptor, "13")


work := func() {

gobot.Every(1*time.Second, func() {

led.Toggle()

})

}


robot := gobot.NewRobot("bot",

[]gobot.Connection{adaptor},

[]gobot.Device{led},

work,

)


robot.Start()

}