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
- 303 All Categories
- 104 Announcements & News
- 52 Product News - New Product/Product Change Notice/ End-of-life
- 184 Welcome Developers!
- 53 Unboxing & Project Sharing
- 24 Tech Updates
- 595 UP Products
- 6 UP Xtreme i12
- 1 UP Squared Pro 7000
- 1 UP Element i12 Edge
- 13 UP Squared V2
- 41 UP 4000
- 24 UP Xtreme i11
- 34 UP Squared 6000
- 49 UP Squared Pro
- 140 UP Xtreme
- 828 UP Squared
- 1.4K UP Board
- 89 UP Core Plus
- 221 UP Core
- 3 UP Xtreme Lite
- 44 UP AI Edge
- 215 Starter Kits & Peripheral