0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ATtiny3224: VL53L0X の使い方

Posted at

ArduinoUno で書き込み装置 jtagtoupdi を使います。

プログラム

VL53L0X_Single/VL53L0X_Single.ino
// ----------------------------------------------------------------
/*
	VL53L0X_Single.ino

				Aug/31/2025
*/
// ----------------------------------------------------------------
#include <Wire.h>
#include <VL53L0X.h>

// ----------------------------------------------------------------
VL53L0X sensor;

#define	PROGRAM	"VL53L0X_Single.ino"
#define	VERSION	"2025-08-31 PM  12:05"

// ----------------------------------------------------------------
void setup()
{
	Serial1.begin(19200);
	delay(1000);
	Serial1.println(PROGRAM);
	delay(1000);
	Serial1.println(VERSION);
	delay(1000);
	Wire.begin();

	sensor.setTimeout(500);
	if (!sensor.init())
	{
		Serial1.println("Failed to detect and initialize sensor!");
		while (1) {}
	}

}

// ----------------------------------------------------------------
void loop()
{
	Serial1.println(sensor.readRangeSingleMillimeters());
	if (sensor.timeoutOccurred())
	{
		Serial1.println(" TIMEOUT");
	}

	delay(1000);
}

// ----------------------------------------------------------------

実行結果

VL53L0X_Single.ino
2025-08-31 PM  12:05
8190
86
78
277
8190
8190
8190
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?