Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

Spammy786

Member Since 30 Apr 2014
Offline Last Active Nov 18 2014 07:46 AM
-----

Topics I've Started

Reading Value from potentiometer

13 November 2014 - 02:49 PM

Hi Guys

 

I am trying to read the values from my potentiometer. I got it working but the output is not really what I was expecting.

 

Firstly I dont understand the concept of the channels. 

Like for example, you physically connect something to PIN 0, but instead of choosing PIN 0, you have to select Cpu.AnalogChannel.ANALOG_0.

Is there any user friendly documentation on this, but anyways back to my problem.

 

I was using some snippnets from 1 of the posts I found in the netduino forums, basically the guy was just reading values from the potentiometer. I would like to do the same. heres the potentiometer I have

http://netram.co.za/...entiometer.html

 

But this guy was setting a range in his example. (pot.setrange(0,100)) I dont have those options. and I just want round numbers and not decimals. I just want to read values from 0-100 also in my example. Heres my code. I does output the values but it starts like 1 2 3 then back to 1 2 3 and then if you turn it slightly, it jumps all the way to 202. 

 

Only options I have for the AnalogInput is the following and what do they mean ? I have no clue.

Offset
Pin
Presicion (read only)
Read
ReadRaw
Scale
 

 

It basically needs to be refine and optimized. Any ideas

using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace NetduinoPotTester
{
    public class Program
    {
        public static void Main()
        {
            AnalogInput pot = new AnalogInput(Cpu.AnalogChannel.ANALOG_0);
            while (true)
            {
                int potValue = 0;
                potValue = pot.ReadRaw();
                Debug.Print(potValue.ToString());
            }
        }

    }
}

Thanks guys.


Controlling 2WD Chassis using Motor Driver 1A Dual TB6612FNG

04 November 2014 - 12:20 PM

Hi Guys
 
I have done some minimal work on the Netduino for our company and it was so interesting, I decided to order 1 for myself with a few extra components and try to build a simple 2WD robot that I can control using my android phone over Bluetooth. I got the Bluetooth parts working with my PC to test. I will code the android stuff at a later stage using Xamarin Android.
 
The Problem I am having is controlling the 2 motors. I will post my poor attempt of code below. I found a few examples online but I could not get any of them to work. I am running firmware version 4.3.1.0. So I think the reason some of the examples do not work for me is because they are using an older version of the framework. I tried a cool library I found on codeplex, the link http://uplibrary.codeplex.com/
I tried to this to work but I was not so lucky. I tried a few breakpoints and nothing seems to break but the motors will not turn, they just refuse to turn :(
 
The Components :
1 x Netduino Plus 2
1 x Bluetooth Device (Got this working well with my PC and Netduino, used a framework called 32feet.Net)
1 x Magician Chassis
1 x Motor Driver 1A Dual TB6612FNG
 
Wiring of Motor Driver :
Netduino to TB6612FNG breakout
DIO0 = Standby
DIO1 = AIN1
DIO2 = AIN2
DIO5 = PWMA
DIO6 = PWMB
DIO8 = BIN1
DIO9 = BIN2
Ground to ground 

TB6612FNG breakout to motors
AO1 = Red motor lead (Right)
AO2 = Black motor lead (Right)
BO2 = Black motor lead (Left)
BO1 = Red motor lead (Left) 
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace MotorController
{
    public class Program
    {
        public static void Main()
        {

            OutputPort stby = new OutputPort(Pins.GPIO_PIN_D0, true);
            TB6612FNG motors = new TB6612FNG(Cpu.Pin.GPIO_Pin1, Cpu.Pin.GPIO_Pin2, Cpu.PWMChannel.PWM_5);
            motors.MotorModeA = MotorMode.CW;
            motors.MotorSpeedA = 50;  // Set the motor to 50% speed   
           
            while (true)
            {
                motors.MotorModeA = MotorMode.CW;
                motors.MotorSpeedA = 50;  // Set the motor to 50% speed  
            }

        }

    }
}


Is my netduino bricked ?

31 October 2014 - 05:42 PM

Hi

 

I have a problem with my netduino plus 2, I deployed some code to the device that broke it, so I found the problem and fixed the code but my problem is, Visual studio cant deploy because windows kicks the netduino out.

When I plug the netduino in and MF Depoly tool to erase it, USB is chosen and it picks it up, but when I click erase, it displays another dialog, asking me which sector to erase (I done the process before and it works fine) when I click erase, Windows pops up a message on the taskbar stating (USB device plugged into might not be working correctly) when it popus up that message, MF Deploy says it cannot detect my netduino.

 

If that windows popup didn't appear, I could have erased the programmed and deployed the new one.

I have included the screenshots.

How can I fix this?

 

Thanks


Access Netdunio Plus 2 From Desktop Application

19 October 2014 - 10:16 AM

Hi Guys

 

My requirement is simple and short, Basically I want to my desktop application to automatically detect when my netduino plus 2 is plugged into the usb port of the computer, once its plugged in, I want to have access to the SD card on my netduino. I can create the winforms application but whats the best way to access the SD card from the netudino, I want to get 2 textfiles from the SD card and after that I want to send 2 textfiles to the SD Card.

 

Anybody have some sample code or the best way forward.

Please note I can create the winforms application, Just need help with accessing the SD card in the netduino.

 

Thanks in advance guys.


Receiving Junk from Serial Port

19 October 2014 - 09:24 AM

Hi Guys

 

I am connecting my serial rs232 device to the netduino plus 2, D0 and D1 and GND. The device is a card reader. All it does is just returns the tag code from the card that's presented to it. Basically when I present a card. It is returning the following output :

1

1

1

1

1

1

1

 

It supposed to return the tag code for example #234765732476824

 

The code is very small so I cant seem to find out where I am going wrong, Thanks in advance guys


using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
using System.IO.Ports;
using System.Text;

namespace SerialPortTest
{
    public class Program
    {

        static SerialPort serial;

        public static void Main()
        {
            serial = new SerialPort(SerialPorts.COM1, 9600, Parity.None, 8, StopBits.One);
            //serial.Handshake = Handshake.None;
            serial.ReadTimeout = 500;

            serial.Open();
            serial.DataReceived += new SerialDataReceivedEventHandler(serial_DataReceived);

            Thread.Sleep(Timeout.Infinite);
        }

        static void serial_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            String response = "";
            byte[] bytes = new byte[1];
            while (serial.BytesToRead > 0)
            {
               response += serial.Read(bytes, 0, bytes.Length);
            }
            Debug.Print(response);
        }
    }
}


home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.