Loading...
Welcome,
Guest
. Please
login
or
register
.
June 19, 2013, 05:39:30 pm
|
Arduino Forum
::
Forum 2005-2010 (read only)
::
Software
::
Syntax & Programs
:: Array?
« previous topic
next topic »
Pages: [
1
]
Go Down
Print
Author
Topic: Array? (Read 309 times)
0 Members and 1 Guest are viewing this topic.
hsj
0
Offline
Newbie
Karma: 0
Posts: 1
Array?
«
on:
November 27, 2006, 09:33:17 am »
Bigger
Smaller
Reset
I want to read pin values and put them in a "buffer". My program is like this:
int buffer[361] = 0;
void setup()
{...}
void loop()
{
for(int i=0;i<361;i++)
{
buffer
=analogRead(pinNumber);
}
...
}
But it seems the values can not be written into the array, and some members of the array even have very absurd values. If I output the values of the pins directly then everything is fine. The problem is that they can't be written into the array.
«
Last Edit: November 27, 2006, 09:45:58 am by hsj
»
Logged
neurascenic
0
Offline
Newbie
Karma: 0
Posts: 49
Re: Array?
«
Reply #1 on:
November 27, 2006, 12:22:11 pm »
Bigger
Smaller
Reset
Your only reading one pin at a time. and placing it into your array. then advancing your array.
You would need a more sophisticated loop within a loop and add the values of each pin according to their position.
Or better yet, read all pins at once and place that value into your array.
Follow the link to read all pins at once (actually the register to where they lay)
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1160606668
ñ
Logged
mellis
Forum Administrator
Cambridge, MA
Offline
Faraday Member
Karma: 8
Posts: 3532
Re: Array?
«
Reply #2 on:
November 27, 2006, 03:35:53 pm »
Bigger
Smaller
Reset
You might try removing the
= 0
from the line declaring the array, or replacing it with
= { 0 }
. Otherwise, you might try making the array smaller, as it's possible there's not enough RAM for that many elements.
Logged
Pages: [
1
]
Go Up
Print
« previous topic
next topic »
|
Arduino Forum
::
Forum 2005-2010 (read only)
::
Software
::
Syntax & Programs
:: Array?
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> General Discussion
-----------------------------
Using Arduino
-----------------------------
=> Installation & Troubleshooting
=> Project Guidance
=> Programming Questions
=> General Electronics
=> LEDs and Multiplexing
=> Displays
=> Audio
=> Motors, Mechanics, and Power
=> Sensors
=> Networking, Protocols, and Devices
=> Interfacing w/ Software on the Computer
-----------------------------
Topics
-----------------------------
=> E-Textiles and Craft
=> Robotics
=> Science and Measurement
=> Home Automation and Networked Objects
=> Device Hacking
=> Education and Teaching
=> Interactive Art
=> Product Design
-----------------------------
Development
-----------------------------
=> Suggestions for the Arduino Project
=> Other Hardware Development
=> Other Software Development
-----------------------------
Community
-----------------------------
=> Website and Forum
=> Products and Services
=> Gigs and Collaborations
=> Workshops and Events
=> Local Groups
=> Exhibition / Gallery
=> Bar Sport
-----------------------------
International
-----------------------------
=> Deutsch
=> Español
=> Français
=> Italiano
=> Portugues
=> Scandinavia
-----------------------------
Forum 2005-2010 (read only)
-----------------------------
===> Uno Punto Zero
===> Bar Sport
===> Frequently-Asked Questions
===> News
===> Exhibition
===> Workshops
===> Interfacing
===> Bugs & Suggestions
===> Development
===> Troubleshooting
===> Portugues
===> Deutsch
===> Español
===> Français
===> Italiano
===> Scandinavia
===> Development
===> Interfacing
===> Syntax & Programs
===> Bugs & Suggestions
===> Troubleshooting
===> Report Spam at Arduino.cc
===> Forum
===> Playground Wiki
=> General
=> Hardware
=> Software
=> International
=> Web/Forum/Email/Spam
-----------------------------
Using Arduino
-----------------------------
=> Storage
=> Microcontrollers
-----------------------------
International
-----------------------------
===> Humor y Debate
===> Talleres, Encuentros, ...
===> Tutoriels et cours
===> Réalisations et Projets Finis
===> Le bar
=> Nederlands
===> Software
===> Hardware
===> Proyectos
===> Documentación
=> India
===> Hardware
===> Software
===> Megatopic
-----------------------------
Products
-----------------------------
=> The Arduino Starter Kit
=> Arduino Due
-----------------------------
International
-----------------------------
===> Generale
-----------------------------
Products
-----------------------------
=> Arduino Esplora
=> Arduino GSM Shield
-----------------------------
Maker Faire Rome - The European Edition
-----------------------------
=> Makers
=> Events and Tour
Loading...