I'm still new to the world of programming but I need some help with this if it's possible. If not, that's okay too.
I have this task where I have to establish a connection between C# (WPF) and Arduino. Now, I managed to connect the LCD so it outputs the values from the potenciometer to the LCD screen like in this
Picture Once I have the connection between Arduino and C#, C# must output those values from the potenciometer to the
"Line" form. So, in shorter words, How I change the current value with the potenciometer, the line in C# MUST be moving as I do it. I'm very bad at explaining so hopefully You understood what I was saying :P If anyone could help me with this task, I'd be more than happy. Thanks in advance
Programs: Microsoft Visual Studio (2008-2015), Arduino (latest version)
Language: C#
Application: WPF (.NET Framework 4.5)
OS: Windows
Line Form code:
<Line
Name="TheLine"
Stretch="Fill"
X1="1" X2="1" Y1="0" Y2="1"
Width="2"
HorizontalAlignment="Center"
Stroke="Black"
>
<Line.RenderTransform>
<TransformGroup>
<RotateTransform CenterX="1" CenterY="{Binding ActualHeight, ElementName=TheLine}"
Angle="{Binding Path=Value, ElementName=AngleSlider}" />
</TransformGroup>
</Line.RenderTransform>
</Line>
<StackPanel Grid.Column="1">
<Slider Name="AngleSlider" Minimum="-90" Maximum="90" Value="0" Height="59" Width="200" />
</StackPanel>
Arduino code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int sensorPin = A0;
int sensorValue = 0;
void setup() {
lcd.begin(16, 2);
lcd.print("Welcome!");
delay(3000);
lcd.clear();
Serial.begin(9600);
}
void loop() {
lcd.print("Current value:");
sensorValue = analogRead(sensorPin);
lcd.setCursor(0, 1);
lcd.print(sensorValue /4);
lcd.print("/255 ");
delay(10);
lcd.clear();
Serial.println(sensorValue);
delay(10);
}
What I have tried:
I managed to establish a connection between c# and arduino but to read the values from the potenciometer and bring them onto the line is what I struggle.