BikeSimulater Start
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LibNoise" Version="0.2.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BLELibrary">
|
||||
<HintPath>.\dll\BLELibrary.dll</HintPath>
|
||||
|
||||
Reference in New Issue
Block a user