Show Posts
Pages: 1 ... 30 31 [32] 33 34 ... 110
466  Using Arduino / Programming Questions / Re: Code Question on: November 07, 2013, 01:59:10 pm
As explained it is a kind of "if" statement, but this isn't quite right:
Code:
if (myPwmInhibit)    // if true, means if different to 0
  digitalWrite(PIN_INHIBIT );
else
  digitalWrite(PIN_OUT,ON_STATE);

It is actually equivalent to:
Code:
if (myPwmInhibit)    // if true, means if different to 0
  digitalWrite(PIN_INHIBIT, ON_STATE );
else
  digitalWrite(PIN_OUT,ON_STATE);

In the context of your example, presumably ON_STATE is either zero or one. In this case the exclusive OR operator has the effect of inverting the state. If ON_STATE is zero then ON_STATE^1 is one and vice versa. Note that it does not change the state of ON_STATE.

Pete
467  Using Arduino / Programming Questions / Re: Can Arduino handle 8 bit ASCII? on: November 07, 2013, 01:45:26 pm
Quote
char b = "b\148r";

What is that? It doesn't compile.

As AWOL has already pointed out, this is all that's needed.
Quote
unsigned char b = 148;
Pete
468  Using Arduino / Project Guidance / Re: [Orientation]RGB Color Picker with Camera on: November 07, 2013, 01:39:17 pm
Quote
the teacher knows nothing about Arduino
So why are you going to use Arduino?
What kind of course is this? Engineering, Comp Sci, ???

Pete
469  Using Arduino / Storage / Re: Why does my SD Card store duplicates of my data? on: November 07, 2013, 11:38:55 am
Read this first: How to post code properly
and then fix up the code in your first post.

Pete
470  Using Arduino / Project Guidance / Re: Help needed ASAP to detect rounded rectangle using C sharp on: November 07, 2013, 11:04:44 am
You could try asking in the ImageMagick forum http://www.imagemagick.org/discourse-server/index.php although AFAIK it does not have a C# interface.


Pete
471  Using Arduino / Project Guidance / Re: Comparing two encryption schemes according to performance: How? on: November 06, 2013, 10:10:35 pm
Have you got the code for the two encryption methods? Some methods involve tables which are too big to fit in an UNO.

Pete
472  Using Arduino / Programming Questions / Re: Character encoding confusion on: November 06, 2013, 10:42:16 am
Code:
client.println(file.buffer[i]);
I presume that this will send a carriage return and a line feed after every character.
Try:
Code:
client.print(file.buffer[i]);

Pete
473  Using Arduino / Displays / Re: TFT Display to be used with a Teensy 3.0 on: November 02, 2013, 06:34:06 pm
You should ask on the Teensy forum http://forum.pjrc.com/forum.php

Pete
474  Community / Gigs and Collaborations / Re: programmer/engineer needed on: November 01, 2013, 04:32:05 pm
No offense taken smiley But you still haven't answered the implied question.

Pete
475  Using Arduino / Programming Questions / Re: Ethernet if else statement not working...? on: November 01, 2013, 12:08:02 pm
You have two problems.
The first is that you define c to be a char and read a char from the client:
Code:
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
    if ((c) >= 1){

but you test it as if it was an integer. You could try:
Code:
if ((c) >= '1'){

But then you have another problem. What if there are 10 or more messages waiting? I'll let you ponder that one.

Pete
476  Using Arduino / Programming Questions / Re: how to change the GPS sentence? on: October 31, 2013, 10:27:47 am
See the reply from xjet about half way down the page here:
https://forum.sparkfun.com/viewtopic.php?t=6446

Pete
477  Community / Gigs and Collaborations / Re: Need help on manual data entry (state machine) project [paid] on: October 30, 2013, 10:37:24 am
OK, got it.

Pete
478  Community / Gigs and Collaborations / Re: Need help on manual data entry (state machine) project [paid] on: October 29, 2013, 02:14:15 pm
Just out of curiosity, what do these mean?
Quote
Operator Input via multiplexed DO and DI
and
Quote
non-linear data entry

Pete
479  Using Arduino / Programming Questions / Re: Assignment due tomorrow, thought it was an easy fix.... on: October 29, 2013, 12:33:24 pm
You read liftState as a digital input:
Code:
tempTest = digitalRead(liftState);
but you've declared it as LOW:
Code:
int liftState = LOW;
which has a value of zero and so you are actually reading pin zero.

You have not said how the top and bottom switches are wired and you declare them as INPUT with no internal pullup.
Your test of liftBottom, for example,
Code:
if (val == HIGH) {
appears to assume that the switch is normally LOW (and therefore you have a pulldown resistor on the switch) and the switch is active when it is HIGH. If you haven't got a pulldown resistor on the switch then it will normally read as HIGH and as LOW when it is activated.
You need to figure out how you've wired up the switches and what HIGH and LOW mean with that wiring. If you do not have external pulldown resistors, you should activate the internal pullups on each pin like this:
Code:
  pinMode(liftBottom, INPUT_PULLUP);
and change your code so that it works with LOW being activated.
There are more problems and I seriously doubt that you'll have this working in, hmmm, about 3 hours?
Good luck.

Pete
480  Using Arduino / Programming Questions / Re: kurtosis calculations on an analog signal on: October 28, 2013, 04:38:46 pm
@blwill428
Read this and fix up your posted code: How to post code properly

Pete
Pages: 1 ... 30 31 [32] 33 34 ... 110