All Projects → microsoft → Pxt Filesystem

microsoft / Pxt Filesystem

Licence: mit
File system - beta

Programming Languages

typescript
32286 projects

Labels

Projects that are alternatives of or similar to Pxt Filesystem

Cocos2d Lua Sproto
cocos2d-lua集成sproto协议
Stars: ✭ 14 (-50%)
Mutual labels:  makefile
Openpht
OpenPHT for AML
Stars: ✭ 20 (-28.57%)
Mutual labels:  makefile
Mvvm C Templates
Templates for MVVM-C architecture
Stars: ✭ 27 (-3.57%)
Mutual labels:  makefile
Fdgw2
Build minimal NetBSD bootable disk image
Stars: ✭ 14 (-50%)
Mutual labels:  makefile
Ris
a simple cross-platform resource compiler for c++ projects
Stars: ✭ 15 (-46.43%)
Mutual labels:  makefile
Hubot Slack Docker
Docker container running Github Hubot.
Stars: ✭ 21 (-25%)
Mutual labels:  makefile
Xsensors
a fork of Xsensors with various improvements (GTK3, cleanup, bugfixes, enhancements)
Stars: ✭ 13 (-53.57%)
Mutual labels:  makefile
Jmap
JSON Meta Application Protocol Specification (JMAP)
Stars: ✭ 942 (+3264.29%)
Mutual labels:  makefile
Android device samsung toroplus
Stars: ✭ 15 (-46.43%)
Mutual labels:  makefile
Vault Auth Plugin Example
An example @HashiCorp Vault auth plugin
Stars: ✭ 27 (-3.57%)
Mutual labels:  makefile
Mlgo
Machine Learning with Go Session Material for Golab 2018
Stars: ✭ 15 (-46.43%)
Mutual labels:  makefile
Codk A
Stars: ✭ 15 (-46.43%)
Mutual labels:  makefile
Node Tab
Unix-style tables for command-line utilities
Stars: ✭ 21 (-25%)
Mutual labels:  makefile
Slugrunner
Buildpack application runner for Deis Workflow.
Stars: ✭ 14 (-50%)
Mutual labels:  makefile
Qubes Roadmap
High-level milestone planning for Qubes OS
Stars: ✭ 27 (-3.57%)
Mutual labels:  makefile
Stanford Drupal Profile
A dev / test-only version of the Drupal Hosting Service Configuration
Stars: ✭ 13 (-53.57%)
Mutual labels:  makefile
Android Audioplayer
An AudioPlayer For Android Platform
Stars: ✭ 16 (-42.86%)
Mutual labels:  makefile
Ariane Sdk
Ariane SDK containing RISC-V tools and Buildroot
Stars: ✭ 28 (+0%)
Mutual labels:  makefile
Ansible Environment
Ansible role which adds /etc/environment variables
Stars: ✭ 27 (-3.57%)
Mutual labels:  makefile
Bashmultitool
A library for bash shell program containing useful functions. Can be imported into scripts to create colourful and functional scripts and TUIs.
Stars: ✭ 27 (-3.57%)
Mutual labels:  makefile

File system driver Build Status

To use this package, go to https://makecode.microbit.org, click Extensions and search for filesystem.

~ hint

DEPRECATED - This package is no longer maintained or supported.

~

Usage

The package allows to read and write files to the @boardname@ flash.

~hint

The entire file system content is ERASED when a new .hex file is download onto the @boardname@.

~

Writing data

  • append text and a new line character
files.appendLine("data.txt", "Hello");
  • append text to the file
files.appendString("data.txt", "Hello");
  • append a number (as text) to the file
files.appendNumber("data.txt", 42);

Reading data

  • send the content of a file to serial
files.readToSerial("data.txt");

Settings

The package allows to save and load number settings based on the file system

  • save setting value
files.settingsSaveNumber("calibrated", 1)
  • read setting value
let calibrated = files.settingsReadNumber("calibrated");

File class

The File class allows to keep a file instance open, manipulate the pointer position and read from the file.

  • open, flush or close the file
let f = files.open("data.txt");
f.flush();
f.close();
  • write strings or buffers
let f = files.open("data.txt");
f.writeString("yay");
  • read data
let f = files.open("data.txt");
let buf = f.readBuffer(64);
let c = f.read();
  • set the cursor position
let f = files.open("data.txt");
f.setPosition(42);
let pos = f.position();

Example: Writing accelerometer data

The following program allows to collect accelerometer data and save it in a data.csv file. When the user presses button A, the @boardname@ pauses for 3 seconds, then starts collecting 720 acceleration samples. Each sample is written to the file in a format that can be important by spreadsheet programs (CSV).

let file = "data.csv";
input.onButtonPressed(Button.A, () => {    
    basic.pause(3000);
    files.remove(file);
    files.appendLine(file, "Time\tAcceleration");
    for (let i = 0; i < 100; ++i) {
        let t = input.runningTime();
        let ay = input.acceleration(Dimension.Y);
        files.appendLine(file, t + "\t" + ay);
        control.waitMicros(20);
    }
});
input.onButtonPressed(Button.B, () => {
    files.readToSerial(file);
    basic.showString(":)")
})

Supported targets

  • for PXT/ microbit
  • for PXT/ calliope

License

MIT

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].