Pikir dan Rasa

cogito ergo sum

Tinkering #03 dengan printing array pada Arduino

leave a comment »

Lanjutan ketiga tinkering dengan Arduino, array & serial printing:



const int BAUDRATE = 9600;

const int BESARBUFF = 7;

//char buff1[5] = {10,20,3,40,5};
char buff1[BESARBUFF];

char buff2[] = {10,20,'g',3,'N',40,'ab','ba',5};

void setup(){
  const byte ukuran_buff1 = ( sizeof(buff1)/sizeof(char) );
  Serial.print("Besar ukuran buff1: ");
  Serial.print(" atau ");
  Serial.print("Isi dari buff1: ");
  printBuff(buff1, ukuran_buff1);
  Serial.print("Print dengan printbuff: ");
  printBuff(buff1, ( sizeof(buff1)/sizeof(char) ));

  Serial.print("Print dengan Serial.println: ");

  char *ptr;
  ptr = (buff1);
  Serial.print("Print dengan Serial.println ptr: ");
  Serial.print("Print dengan printbuffptr: ");

void loop(){

void printBuff(char *alamatarray, const byte buffsize){
  for(byte i=0; i < buffsize; i++){

void clearBuff(char *alamatarrayclr, const byte buffsizeclr){
  for(byte i=0; i < buffsizeclr; i++){
    (alamatarrayclr[i]='\0'); // isi dengan "null character"

void printbuffptr(char *data){

void isibuff1(){
  for (int i=0; i < BESARBUFF; i++){
    buff1[i] = (i * 10);







Written by sunupradana

January 1, 2012 at 11:52 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: