BikeSimulater Start

This commit is contained in:
fabjuuuh
2020-09-09 15:02:10 +02:00
parent 9c55b545dd
commit 149c327f7e
2 changed files with 34 additions and 7 deletions

View File

@@ -1,13 +1,17 @@
using System;
using LibNoise.Primitive;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace Hardware.Simulators
{
class BikeSimulator
{
IDataConverter dataConverter;
private int eventCounter = 0;
public BikeSimulator(IDataConverter dataConverter)
{
@@ -16,22 +20,41 @@ namespace Hardware.Simulators
public void StartSimulation()
{
//4A-09-4E-05-19-16-00-FF-28-00-00-20-F0
float x = 0.0f;
ImprovedPerlin improvedPerlin = new ImprovedPerlin(0,LibNoise.NoiseQuality.Best);
while (true)
{
byte[] array = { 0x19, 0x16, 0x00, 0xFF, 0x28, 0x00, 0x00, 0x20, 0xF0 };
byte[] array = { 0x19, 0x16, 0x00, 0xFF, 0x28, 0x00, 0x00, 0x20 };
Console.WriteLine(improvedPerlin.GetValue(x)+1);
//0x10 message
dataConverter.Bike(array);
/*foreach(byte s in array)
{
Console.Write("{0:X}",s);
}*/
dataConverter.Bike(GenerateBike(improvedPerlin.GetValue(x)+1));
//0x19 message
dataConverter.Bike(array);
//dataConverter.Bike(array);
//Heartbeat message
dataConverter.BPM(array);
//dataConverter.BPM(array);
Thread.Sleep(1000);
x += 1f;
eventCounter++;
}
}
private byte[] GenerateBike(float perlin)
{
byte[] bikeByte = {0x19,0x}
return new byte[1];
}
private double Random(double x)
{
return (Math.Sin(2 * x) + Math.Sin(Math.PI * x) + 2) / 4;
}
}
}