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.
Photo

type conversions for netmf

netmf c# netduino plus 2

  • Please log in to reply
1 reply to this topic

#1 m.sainath

m.sainath

    New Member

  • Members
  • Pip
  • 7 posts

Posted 22 April 2013 - 03:37 PM

using System;using System.Net;using System.Net.Sockets;using System.Threading;using System.IO.Ports;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.Netduino;namespace barcode_scanner{    public class Program    {        public static void Main()        {                       InputPort bs = new InputPort(Pins.GPIO_PIN_D1, false, Port.ResistorMode.Disabled);                        bool bsState;            if(bs == true)            {                bsState = bs.Read();            }        }    }}

 

 

I get an error message stating that "Operator '==' cannot be applied to operands of type 'Microsoft.SPOT.Hardware.InputPort' and 'bool' "

How do i deal with this. Also could anyone please help me in saving data to a memory card for a netduino plus 2 with detailed explanation. Thanks in advance.



#2 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 22 April 2013 - 05:25 PM

Try

 

if (bs.Read() == true)

Regards,

Mark


To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

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.