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.

rex64

Member Since 31 Dec 2011
Offline Last Active Mar 09 2012 05:34 PM
-----

Posts I've Made

In Topic: DHT11/22 sensor managed driver

09 March 2012 - 05:14 PM

Do you know of a good tutorial on how to build custom firmwares? I download the files but was confused on what to do. Also, has anyone built a compiled file they can post? I have a web server if it is to big to post here. Thanks! This is what I am working on: http://forums.netdui...h__1#entry22320

In Topic: MPL115A1 Barometric Pressure Sensor Breakout

09 March 2012 - 05:11 PM

Nothing yet. I put this on hold hoping someone would have more .NET code soon. Also, I have been learning more about C#. If anyone has some good code examples that would be great!

In Topic: Reset not working, preparing to deploy assemblies to the device netduino

17 January 2012 - 07:33 PM

Any other ideas?

In Topic: MPL115A1 Barometric Pressure Sensor Breakout

16 January 2012 - 02:27 AM

I am not sure how to convert the #defines to constants? Are these shorts? Any other tips you can give me would be great. I am used to VB .NET and am very rusty on my C++.

Error 1 Single-line comment or end-of-line expected C:\Users\Jeff\AppData\Local\Temporary Projects\MPL115A1 Pressure Sensor\Program.cs 4 21 MPL115A1 Pressure Sensor



 // the sensor communicates using SPI, so include the library:
//#include <SPI.h>

	#define PRESH   0x80
	#define   PRESL   0x82
	#define   TEMPH   0x84
	#define   TEMPL   0x86

	#define A0MSB   0x88
	#define A0LSB   0x8A
	#define B1MSB   0x8C
	#define B1LSB   0x8E
	#define   B2MSB   0x90
	#define B2LSB   0x92
	#define C12MSB   0x94
	#define   C12LSB   0x96

	#define CONVERT   0x24   

	#define chipSelectPin 10
	#define shutDown 7

	float A0_;
	float B1_;
	float B2_;
	float C12_;


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;

	/*
	MPL115A1 sparkfun breakout baropressure meter
	SDN   	: pin 7
	CSN   	: pin 10
	SDI/MOSI  : pin 11
	SDO/MISO  : pin 12
	SCK   	: pin 13
	*/



namespace MPL115A1_Pressure_Sensor
{
	public class Program
	{
    	public static void Main()
    	{
        	// write your code here


    	}

	}
}


	void setup() {
  	Serial.begin(115200);

  	// start the SPI library:
  	SPI.begin();   

  	// initalize the data ready and chip select pins:
  	pinMode(shutDown, OUTPUT);
  	digitalWrite(shutDown, HIGH);
  	pinMode(chipSelectPin, OUTPUT);
  	digitalWrite(chipSelectPin, HIGH);
  	delay (10);
	 
  	// read registers that contain the chip-unique parameters to do the math
  	unsigned int A0H = readRegister(A0MSB);
  	unsigned int A0L = readRegister(A0LSB);
         	A0_ = (A0H << 5) + (A0L >> 3) + (A0L & 0x07) / 8.0;
	 
  	unsigned int B1H = readRegister(B1MSB);
  	unsigned int B1L = readRegister(B1LSB);
          	B1_ = ( ( ( (B1H & 0x1F) * 0x100)+B1L) / 8192.0) - 3 ;
	 
  	unsigned int B2H = readRegister(B2MSB);
  	unsigned int B2L = readRegister(B2LSB);
          	B2_ = ( ( ( (B2H - 0x80) << 8) + B2L) / 16384.0 ) - 2 ;
	 
  	unsigned int C12H = readRegister(C12MSB);
  	unsigned int C12L = readRegister(C12LSB);
          	C12_ = ( ( ( C12H * 0x100 ) + C12L) / 16777216.0 )  ;
	}

	void loop() {
   	Serial.print("de druk is : ");
   	Serial.println(baropPessure());
   	delay(1000);
	} 

	//Read registers
	unsigned int readRegister(byte thisRegister ) {
  	unsigned int result = 0;   // result to return
  	digitalWrite(chipSelectPin, LOW);
    	delay(10);
    	SPI.transfer(thisRegister);
    	result = SPI.transfer(0x00);
  	digitalWrite(chipSelectPin, HIGH);
  	return(result);
	}

	//read pressure
	float baropPessure(){
  	digitalWrite(chipSelectPin, LOW);
  	delay(3);
    	SPI.transfer(0x24);
    	SPI.transfer(0x00);
    	digitalWrite(chipSelectPin, HIGH);
    	delay(3);
  	digitalWrite(chipSelectPin, LOW);
    	SPI.transfer(PRESH);
    	unsigned int presH = SPI.transfer(0x00);
        	delay(3);
    	SPI.transfer(PRESL);
    	unsigned int presL = SPI.transfer(0x00);
        	delay(3);
    	SPI.transfer(TEMPH);
    	unsigned int tempH = SPI.transfer(0x00);
        	delay(3);
    	SPI.transfer(TEMPL);
    	unsigned int tempL = SPI.transfer(0x00);
        	delay(3);
    	SPI.transfer(0x00);
      	delay(3);
  	digitalWrite(chipSelectPin, HIGH);

  	unsigned long press = ((presH *256) + presL)/64;
  	unsigned long temp  = ((tempH *256) + tempL)/64;

  	float pressure = A0_+(B1_+C12_*temp)*press+B2_*temp;
  	float preskPa = pressure*  (65.0/1023.0)+50.0;

	return(preskPa);
	}

In Topic: Convert to C# Humidity and Temperature Sensor - RHT03 RHT-22

16 January 2012 - 02:01 AM

What language is the firmware written in? Do I use this compiler: Visual C++ 2010 Express? Also, are these the files I would be editing? \netduinofirmware\netduinofirmware_4.1.0.6\Solutions\NetduinoPlus Also, I do not understand what this step means. Am I changing the Micro Framework or the Duino firmware? Are they the same? 2. Copy these files over the Platform Kit (typically into C:\MicroFrameworkPK_v4_1) If you get a chance, it would be great to have your built firmware, since I am new at these things. Thanks!

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.