Recent Posts

Pages: [1] 2 3 ... 10
1
I cannot look at your attachment on my mobile device, but I can tell you this:

- You should autoformat your Arduino code (CTRL-T on a PC) and post it using copy and paste inside of code tags.
- You should post COMPLETE error messages using copy and paste inside of another pair of code tags.
- You should read the locked posts at the top of the forum on how to use the forum and how to post properly.

2
Gotcha...

I have the variables set from the 6 msdeq7 chips and want to apply the output values to code. Ridht now I'm trying to figure out how to use variables to strove all the leds using "channelSub". Which will have to be devoted by 4 for a 0 to 255 output. Or devided by 10.24 so I get values of 0 to 100. Then I want to transition from purple at 0 to 33, blue from 34 to 66 and red from 67 to 100. I'm also using the code below to pull out only bass.

Code: [Select]

if (channelSub) {
uint8_t val = MSGEQ7.get(MSGEQ7_BASS); // Used to remove unwanted frequency's and only use Bass
channelSub[SpectrumBand] = analogRead(5);


So I want to be able to say something like

Code: [Select]

If ChannelSub = 0 < 33, SubChannelColor (255,0,255) // for purple
If ChannelSub = 34 < 66, SubChannelColor (0,0,255) // for blue
If ChannelSub = 67 < 100, SubChannelColor (255,0,0) // for red


And loop that with a delay of 500ms and fade in to each color with a 250ms delay.

I know my explanation is not actual code but it's the best way of explaining what I need. Then I'll start working on the more complex things like the 9 stationary leds which will move around depending on level of the values of the other speakers.

In addition to this I was wondering if it's possible to overlay the other leds on top so no matter where the 9 leds move on the strip.. The rest if the strip will change color according to this code.

3
Hi, since I'm only familiar with boolean stuff I made up this code. It works more or less as intended. The cursor moves with keypad presses and displays ******. The only thing I can't seem to figure out is how to verify the password.


Here's my full Code
Code: [Select]

#include <Password.h>
#include <LiquidCrystal.h>
#include <Keypad.h>
int a = 0;

Password password = Password( "1234" );

const byte ROWS = 4;
const byte COLS = 4;

boolean MainMenuMode = false;
boolean SecurityMode = false;
boolean CoopMode = false;


char keys[ROWS][COLS] = {
  {'1', '2', '3'},
  {'4', '5', '6'},
  {'7', '8', '9'},
  {'*', '0', '#'}
};
byte rowPins[ROWS] = {3, 5, 6, 7};
byte colPins[COLS] = {8, 9, 10};

Keypad myKeypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);

void setup() {

  lcd.begin(16, 2);
  MainMenu();
  Serial.begin(9600);
}

void loop() {
  char myKey = myKeypad.getKey();

  if (myKey == '#') {
    SecurityMode = true;
    SecurityScreen();
  }

  if (SecurityMode == true && myKey == '*') {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("  Invalid Key  ");
    delay (2000);
    SecurityScreen();
  }
  else if (MainMenuMode == true && myKey == '*') {
    MainMenu(); //Replace with coop Door function down the line
  }

  if (SecurityMode == true) {
    if (myKey >= '0' && myKey <= '9') {
      lcd.setCursor(a, 1);
      lcd.print('*');
      a++;
    }
  }
  if (a == 4) {
    checkPassword();
    password.append(myKey);
  }
}

void checkPassword() {
  if (password.evaluate()) {
    Serial.println("Success");

  } else {
    Serial.println("Wrong");
    password.reset();
  }
}

void SecurityScreen() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(" Enter Password");
}

void MainMenu() {
  lcd.setCursor(0, 0);
  lcd.print("* for Coop");
  lcd.setCursor(0, 1);
  lcd.print("# for Security");
  MainMenuMode = true;
  SecurityMode = false;
  CoopMode = false;
}



And here's the statement that controls the password checking.
Code: [Select]

if (SecurityMode == true && myKey == '*') {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("  Invalid Key  ");
    delay (2000);
    SecurityScreen();
  }
  else if (MainMenuMode == true && myKey == '*') {
    MainMenu(); //Replace with coop Door function down the line
  }

  if (SecurityMode == true) {
    if (myKey >= '0' && myKey <= '9') {
      lcd.setCursor(a, 1);
      lcd.print('*');
      a++;
    }
  }
  if (a == 4) {
    checkPassword();
    password.append(myKey);
  }
}

void checkPassword() {
  if (password.evaluate()) {
    Serial.println("Success");

  } else {
    Serial.println("Wrong");
    password.reset();
  }
}
4
General Discussion / Re: Atmega88 to Uno/Nano
Last post by CrossRoads - Today at 04:18 am
Compiles just fine as is for an Uno ('328P).  Try running it on  a board.
Port C0, C1 are pins A0, A1.
5
Hey guys

Everytime I download Arduino to a Macbook, it creates a folder called "Arduino" inside the Documents folder. This folder is the one that contains all installed libraries. On OS we usually store our applications and its folders on the Applications folder.

For example, Adobe always creates a folder for itself and it is storaged in Applications. However, Arduino stores it in Documents and if you try to move it to Applications it just ignores that folder and creates another one in Documents again.

I was wondering if there was a way to store this folder in Applications instead of Documents. Documents is a really bad folder to store it.

Thank you
6
Programming Questions / Re: HELP, problems with Serial...
Last post by 232 - Today at 04:17 am
Sorry, I forgot that this "forum" has no reference for String
So I used Mrs Google to look for "String in C++"
And here is a link to "compare" function / method.
Study it and then come back for more help.
It is really not that difficult, after you get out of "cut and paste" mode.
Try it.


http://www.cplusplus.com/reference/string/string/compare/
7
Hi, I want to read the water flow from meter basically which is water meter and has a rs 485 on meter backside which i have connected to arduino mega 2560 through another MAX485.

The positive pin of meter's rs 485 is connected to the max 485 pin A.
The negative pin of meter's rs485 is connected to the MAx485 pin B.

On other side of max485 D1 pin is connected to arduino pin tx1 and max485 R0 pin is connected to arduino pin Rx1.

Pins DE and RE are connected to arduino pin 3 for transmitting and receiving.All and other connections are also made perfectly like grounding and 5v to max485 from arduino.

But i can find why the code can't read the value and print on serial monitor instead of that it displays "err" message on serial monitor which means  no response from meter.

Please help out to solve this problem i am stuck at this from very long.

Thanks
8
Programming Questions / Re: DC motor cannot stop
Last post by Due_unto - Today at 04:16 am
You need to set a variable as a flag to indicate what the previous direction the motor had turned. Lets say if the flag is set to 0, meaning raining, the motor had turned clockwise. As the loop runs and sees that it is still raining. It wants to turn the motor back on for clockwise but before doing that the loop checks the flag. If it is at 0 then nothing will happen. The loop keeps running, checking the rain thingy. Eventually the sun comes out and now the loop wants to turn the motor on counter clockwise. It checks the flag and sees the last movement was clockwise, now it is ok to turn the motor on counter clockwise for one half second (very short clothesline?). Right after the command to start the motor for sunny day, the flag is set to 1, it's a bright, sun-shiny day. The motor runs for half a second, stops, and the program now continues looping, doing nothing with the motor until the rain starts.
Without the flag the loop keeps turning the motor back on several microseconds after it was turned off because all it is doing is checking the sensor and operating the motor.
9
Programming Questions / Re: DC motor cannot stop
Last post by ilasach - Today at 04:14 am
Thank you for answering. Actually I'm using 2channel relay. If I use relay, do I just need to change the coding or I must use limit switch ?
10
trying to write my own fix program dont how to fix this one problems help would be appreciated thank you
Pages: [1] 2 3 ... 10