This commit is contained in:
Luca Warmenhoven
2024-05-29 15:22:39 +02:00
parent bd74b0b5aa
commit 3966824b76
2 changed files with 28 additions and 21 deletions

View File

@@ -1,24 +1,22 @@
const address = 'http://145.92.8.135:3445/';
const data = {
rotationX: 1,
rotationY: .4,
rotationZ: .1,
accelerationX: 1,
accelerationY: 2,
accelerationZ: 4,
deviceId: 1,
type: 'data'
};
for ( let i = 0; i < 10; i++)
const address = 'http://192.168.137.45:3445';
const amount = 10;
for ( let i = 0; i < amount; i++)
{
setTimeout(() => {
console.log("Sending data");
fetch(address, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
body: JSON.stringify({
rotationX: 0,
rotationY: 0,
rotationZ: 0,
accelerationX: Math.PI / amount * i,
accelerationY: 0,
accelerationZ: 0,
type: 'data',
deviceId: 0
})
});
}, i * 1000);
}