Author Topic: Controlling Raspberry Pi using AHMI  (Read 8737 times)

Aviraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Controlling Raspberry Pi using AHMI
« Reply #15 on: September 15, 2015, 09:04:21 AM »
Hi Godra

I created the folder /tmp/RasPiGpioTest/ and copied the files there. On trying to run, it is still complaining about a missing directory (a different one though). This time over the the error is:

System.IO.DirectoryNotFoundException: Could not find a part of the path "/tmp/RasPiGpioTest/gpio24/direction".

This is followed by other messages just like the previous time.

I can test it again if you could provide me with the required files and locations.


Avi

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Controlling Raspberry Pi using AHMI
« Reply #16 on: September 15, 2015, 02:58:51 PM »
Aviraj,

According to info found here https://github.com/andycb/PiSharp/wiki/Using-LibGpio , the program should be writing to /tmp/RasPiGpioTest folder only if the library is placed in test mode (otherwise it should be trying to access /sys/class/gpio folder). And in this case we don't want the library in test mode.

Can you open the solution and check the code of MainForm_Load subroutine to confirm that it looks like this:

Code: [Select]
    Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
        ' Use test mode
        LibGpio.Gpio.TestMode = False ' <-- This needs to be set to False
        ' Set paired pin outputs for each pin input (using RaspberryPinNumbers)
        LibGpio.Gpio.SetupChannel(RaspberryPinNumber.Five, Direction.Input)
        LibGpio.Gpio.SetupChannel(RaspberryPinNumber.Six, Direction.Input)
        LibGpio.Gpio.SetupChannel(RaspberryPinNumber.Zero, Direction.Output)
        LibGpio.Gpio.SetupChannel(RaspberryPinNumber.Two, Direction.Output)
        LibGpio.Gpio.SetupChannel(RaspberryPinNumber.Three, Direction.Output)
        LibGpio.Gpio.SetupChannel(RaspberryPinNumber.Four, Direction.Output)
    End Sub

I have attached the whole folder as it was created on my computer (but as suggested it should only be used if the library is placed in Test mode).

You have already done a lot but if you feel like trying again then go for it.

Aviraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Controlling Raspberry Pi using AHMI
« Reply #17 on: October 14, 2015, 05:09:23 PM »
Hi Godra

Sorry for the extremely late response. I was working on some other projects and just got back to working on the Advanced HMI once again. I tested out your solution again by downloading the RasPiGpioTest folder that you provided. The good thing is that the application now opens up and shows the buttons as shown in the picture you posted. However, the actual inputs and outputs do not work. That is, if I connect LEDs to the outputs mentioned (11,13,15 and 16) and click RPi Test button, nothing happens, the LEDs do not turn on.

I am starting to work on something requiring the exact same functionality. Your help will be greatly appreciated.

Thanks

Aviraj