22 lines
625 B
JavaScript
22 lines
625 B
JavaScript
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({
|
|
rotationX: 0,
|
|
rotationY: 0,
|
|
rotationZ: 0,
|
|
accelerationX: Math.PI / amount * i,
|
|
accelerationY: 0,
|
|
accelerationZ: 0,
|
|
type: 'data',
|
|
deviceId: 0
|
|
})
|
|
});
|
|
}, i * 1000);
|
|
} |