Things used in this project

Code

MainPage.xaml.csC#
Quando criado um novo projeto no Visual Studio 2015, cole o código no MainPage.xaml.cs que já é criado automaticamente.
/*MainPage.xaml.cs Code
By: Leonardo Gonçalves - Inatel - Minas Gerais - Brazil
*/
using System.Net.Http;
using Windows.Devices.Gpio;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409

namespace App3
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
            textBox2.Text = "2001";
            GPIO();
        }
        public void GPIO()
        {
            // Get the default GPIO controller on the system
            GpioController gpio = GpioController.GetDefault();
            if (gpio == null)
                return; // GPIO not available on this system

            // Open GPIO 5
            using (GpioPin pin = gpio.OpenPin(5))
            {
                pin.SetDriveMode(GpioPinDriveMode.InputPullDown);
                string pinstate = pin.Read().ToString();
                if (pinstate == "Low")
                {
                    textBox3.Text = "0";
                }
                else
                    textBox3.Text = "1";

                // Set the IO direction as output
                

            } // Close pin - will revert to its power-on state 
        }

        private async void button_Click(object sender, RoutedEventArgs e)
        {
            textBox3.Text = "2001";
            GPIO();
            HttpClient client = new HttpClient();
            string url = "http://104.131.189.228/ws/webresources/SetSensor?key=Teste1&&load=(";
            url = string.Concat(url, textBox2.Text);
            url = string.Concat(url, ",");
            url = string.Concat(url, textBox3.Text);
            url = string.Concat(url, ")");
            HttpResponseMessage response = await client.GetAsync(url);
            string x = response.StatusCode.ToString();
            string y = await response.Content.ReadAsStringAsync();
            textBox1.Text = x + y;
        }
    }
}

Credits

1510947 574075536015733 1458936564 n
Leonardo Ribeiro Gonçalves

Master Degree Student at Federal University of Itajuba - Brazil / Telecommunications Engineer graduated at Inatel - Minas Gerais - Brazil

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Spectacles with InstagramPi
Intermediate
  • 70
  • 2

Full instructions

Spectacles for Instagram with Raspberry Pi Zero.

Spectacles with InstagramPi

Team theinventorhouse

Pushing your Raspberry Pi to the cloud
Intermediate
  • 31
  • 1

Protip

This tutorial shows how to push web services running on your Pi to the cloud using popular tunneling services like ngrok or dataplicity.io

Smart Conductive 'On Air' Sign!
Intermediate
  • 802
  • 12

Full instructions

Raspberry Pi + Bare Conductive Paint + Pi Cap + RGB LEDs = AWESOME CONDUCTIVE SIGN!

Sense and Display with Android Things and Kotlin
Intermediate
  • 243
  • 3

Full instructions

This project shows how to get started to read I2C temperature sensor and display the reading to OLED display using Android Things and Kotlin

Trigger Google Assistant on Pi Using Ultrasonic HC-SR04
Intermediate
  • 760
  • 4

Trigger Google Assistant SDK on RPi using ultrasonic sensor HC-SR04 on Raspberry Pi.

CNC Controller in Python
Intermediate
  • 1,020
  • 10

Full instructions

First ever CNC machine controller implementation in pure Python.

Sign up / LoginProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlog