Skip to content

Moduler Things Core XY

coreXY
alt text

Moduler Things site

site

Code js

alt text

Firmware

OSAP arduino library

Stepper moduler for Xiao

Note

This simple-stepper is a version of the firmware when I use in Leon. The code has been updated so it is no longer the same structure as it was during Leon’s bootcamp

Download from Quentins BhutanWS ← updated version

├── code
│   ├── bin
│   │   └── stepper-hbridge-rp2040.ino.uf2
│   └── stepper-hbridge-rp2040
│       ├── motionStateMachine.cpp
│       ├── motionStateMachine.h
│       ├── stepper-hbridge-rp2040.ino
│       ├── stepperDriver.cpp
│       └── stepperDriver.h    

stepperDriver.cpp

#define APWM_PIN 6
#define AIN1_PIN 7
#define AIN2_PIN 0

#define BPWM_PIN 3
#define BIN1_PIN 2
#define BIN2_PIN 4

stepperDriver.h

#define PIN_LIMIT 29

Servo moduler for Xiao

https://github.com/modular-things/modular-things/tree/main/things/servo-xiao/firmware/servo-thing

#include <osap.h>
#include <Servo.h>

#define PIN_SERVO 29

Servo servo;

OSAP_Runtime osap;
OSAP_Gateway_USBSerial serLink(&Serial);
OSAP_Port_DeviceNames namePort("servo");

uint8_t rgb[3] = {0, 0, 255};
boolean ledState = false;

void writeMicroseconds(uint8_t* data, size_t len) {
  uint16_t pulse_us = data[1] * 256 + data[0];

  servo.writeMicroseconds(pulse_us);
}

void updateRGB() {
  if (ledState) {
    analogWrite(PIN_LED_R, 255-rgb[0]);
    analogWrite(PIN_LED_G, 255-rgb[1]);
    analogWrite(PIN_LED_B, 255-rgb[2]);
  } else {
    analogWrite(PIN_LED_R, 255);
    analogWrite(PIN_LED_G, 255);
    analogWrite(PIN_LED_B, 255);
  }
}

void onRGBPacket(uint8_t* data, size_t len){
  rgb[0] = data[0];
  rgb[1] = data[1];
  rgb[2] = data[2];
  ledState = true;
  updateRGB();
}

void onLEDPacket(uint8_t* data, size_t len){
  ledState = data[0] > 0;
  updateRGB();
}

OSAP_Port_Named setRGB("setRGB", onRGBPacket);
OSAP_Port_Named setLED("setLED", onLEDPacket);
OSAP_Port_Named writeMicroseconds_port("writeMicroseconds", writeMicroseconds);

void setup() {
  osap.begin();
  analogWriteResolution(8);
  pinMode(PIN_LED_R, OUTPUT);
  pinMode(PIN_LED_G, OUTPUT);
  pinMode(PIN_LED_B, OUTPUT);
  updateRGB();

  servo.attach(PIN_SERVO, 500, 2500);
}

void loop() {
  osap.loop();
}

Penholder

Ref. Plotter ver 2

Board

Stepper Module

From here

Output Module (Servo/MOSFET/LED )

bad sch
alt text alt text
Download Autodesk Fusion Electronics file

Convert SVG to XY position

ChatGPT prompt

これは、svgファイルの中身です。
ここで書かれている図形の頂点座標をリストにして返してください
ただし、この座標を、[[x0,y0],[x1,y1],......]というようなフォーマットに変換して出力してください。
座標値の単位はmmで出力してください

This is the content of the svg file.
Please return a list of the vertex coordinates of the shape written here.
However, please convert these coordinates to a format such as [[x0,y0],[x1,y1],......] and output them.
Please output the coordinate values ​​in mm.
alt text

logo_xy_pos_inJS ( not included FabLab symbol )

Todo

キーボードからの入力を取得する


Last update: March 6, 2024