High signal on GPIO

LucyS
New Member Posts: 1 ✭
Hello,
I am using the UP Squared board with Windows 10 IoT and working on a C + + project that uses the input signal of a sensor, but it always stays high. Here's the sample code that displays the status of the pin, but shows only a high level. I am stuck at this for a few days and any help will be appreciated!
MainPage::MainPage()
{
InitializeComponent();
InitPin(); if (pin != nullptr) { timer_ = ref new DispatcherTimer(); TimeSpan interval; interval.Duration = 1000 * 1000 * 10; timer_->Interval = interval; timer_->Tick += ref new EventHandler<Object ^>(this, &MainPage::GetPinValue); timer_->Start(); }
}
void CaptureImage::MainPage::InitPin()
{
auto gpio = GpioController::GetDefault();
// Set up our GPIO pin for setting values. pin = gpio->OpenPin(LED_PIN); // Configure pin for input. pin->SetDriveMode(GpioPinDriveMode::Input);
}
void CaptureImage::MainPage::GetPinValue(Object ^sender, Platform::Object ^args)
{
pinValue = pin->Read();
SensorValue->Text = pinValue.ToString();
}
Best regards!
Tagged:
Tagged
Categories
- 284 All Categories
- 104 Announcements & News
- 44 Product News - New Product/Product Change Notice/ End-of-life
- 179 Welcome Developers!
- 49 Unboxing & Project Sharing
- 18 Tech Updates
- 350 UP Products
- 5 UP Xtreme i11
- 6 UP Squared 6000
- 38 UP Squared Pro
- 124 UP Xtreme
- 789 UP Squared
- 1.4K UP Board
- 83 UP Core Plus
- 215 UP Core
- 3 UP Xtreme Lite
- 40 UP AI Edge
- 213 Starter Kits & Peripheral