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.

laik777

Member Since 14 Jul 2011
Offline Last Active Aug 02 2013 08:42 PM
-----

Topics I've Started

problem with sd card

08 August 2011 - 09:41 AM

I have problems with sd card.
I am using NetduinoFirmware_v4.1.1.0_Beta1

Micro sd:
1GB
sd-C01G TAIWAN

My References in Visual Studio:
Microsoft.SPOT.Hardware
Microsoft.SPOT.IO
Microsoft.SPOT.Native
mscorlib
SecretLabs.NETMF.Hardware
SecretLabs.NETMF.Hardware.Netduino
SecretLabs.NETMF.Hardware.NetduinoPlus
SecretLabs.NETMF.IO
System
System.IO


Look i tried with this code:
**************************************
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using System.IO;
using SecretLabs.NETMF.IO;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using Microsoft.SPOT.IO;

namespace SDTest
{


public class Program
{
public static void Main()
{
DirectoryInfo rootDirectory = new DirectoryInfo(@"\\SD\\");

RecurseFolders(rootDirectory);
}

private static void RecurseFolders(DirectoryInfo directory)
{
if (directory.Exists)
{
Debug.Print(directory.FullName);

foreach (FileInfo file in directory.GetFiles())
{
Debug.Print(file.FullName);
}

foreach (DirectoryInfo subDirectory in directory.GetDirectories())
{
RecurseFolders(subDirectory);
}
}
}
}

}
*************************************

and in output window i receive this:

**************
There were deployment errors.
Device not found or cannot be opened-USB:NetduinoPlus
***********************************************

Please if someone could help me .

Thanks in advance

how to a read temperature from the web

19 July 2011 - 02:35 PM

Hey
I am new here.
I would like to know how to read a temperature from the web.

This is my program to read the temperature and it s working well:

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.NetduinoPlus;

namespace i2c_bus_temp
{
    public class Program
    {
       public static void Main()
       {
           byte[] buffer_read = new byte[2];
           byte[] buffer_write = new byte[1];


           I2CDevice.Configuration config = new I2CDevice.Configuration(0x48, 100); // naslov naprave v   hexa,binarno je1001000, zadnji trije določajo A2 A1 A0.
          I2CDevice RTC = new I2CDevice(config);

           buffer_write[0] = 0x00;

           I2CDevice.I2CReadTransaction tran_read = I2CDevice.CreateReadTransaction(buffer_read);
           I2CDevice.I2CWriteTransaction tran_write = I2CDevice.CreateWriteTransaction(buffer_write);


           while (true)
           {
               I2CDevice.I2CTransaction[] tran = new I2CDevice.I2CTransaction[] { tran_write };

               int data = RTC.Execute(tran, 100);

               Debug.Print("\nThe number of data transfered is: " + data.ToString());

               tran = new I2CDevice.I2CTransaction[] { tran_read };

               data = RTC.Execute(tran, 100);

               int tempH;
               int tempL;
               tempH = buffer_read[0]*8;  
               tempL = buffer_read[1]/32;
               Debug.Print("\nThe number of data transfered is: " + (tempH+tempL)/8.0 +" °C");
               Thread.Sleep(1000);
           }


       }

    }
}

I will be hapy if someone could connect my temperature to the web with using this program:

using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using Blinq.Netduino.Web;

namespace ServerExample
{
    /// <summary>
    /// Example for using the Blinq.Netduino.Webserver class
    /// </summary>
    public class Program
    {

     
       static InputPort bb = new InputPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled);

      
       static WebServer server = new WebServer(80);

       public static void Main()
       {
           bool buttonState = false;

          
           server.CommandReceived += new WebServer.CommandReceivedHandler(server_CommandReceived);
           
           server.AllowedCommands.Add(new WebCommand("button", 0));

         
           server.Start();

       }

      
       private static void server_CommandReceived(object source, WebCommandEventArgs e)
       {
           Debug.Print("Command received:" + e.Command.CommandString);
           switch (e.Command.CommandString)
           {
               
               case "button":
                   {
                      
                       e.ReturnString = "<html><body><p>Butoon je v stanju: " + !bb.Read() + "</p></body></hmtl>";
                       break;
                   }
           }
       }
    }
}


Thanks in advance:)

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.