1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { set } from "https://esm.town/v/std/set?v=11";
import { chorus_get_mag_data } from "https://esm.town/v/hyperglitch/chorus_get_mag_data";
import process from "node:process";
// get and parse magnetometer data from https://services.swpc.noaa.gov/text/ace-magnetometer.txt
// used for chorus art installation
export async function chorus_data(auth) {
// check auth
if (auth != process.env.chorus_access) {
return "";
}
let data = await chorus_get_mag_data();
await set("chorus_stored_data", data);
const last = data[data.length - 1];
return last.x + "\n" + last.y + "\n" + last.z + "\n" + last.tot + "\n\n";
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023