Skip to content

Instantly share code, notes, and snippets.

@cebbus
Created April 27, 2016 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cebbus/014d358aa5e1a0f530d55944348c70c2 to your computer and use it in GitHub Desktop.
Save cebbus/014d358aa5e1a0f530d55944348c70c2 to your computer and use it in GitHub Desktop.
var newPanelData = new PanelData({ //rastgele veri oluşturuluyor (panelden verinin gelmesi)
panelId: key,
current: parseInt(Math.random()*1000),
voltage: parseInt(Math.random()*1000),
light: parseInt(Math.random()*100),
temperature: parseInt(Math.random()*100),
moisture: parseInt(Math.random()*100),
date: new Date()
});
newPanelData.save(function(){ //verinin veri tabanına kaydedilmesi
console.log('Veri kaydedildi. Panel id : ' + newPanelData.panelId); //log
});
io.emit('retrievePanelData', newPanelData); //gelen verinin kullanıcılara gönderilmesi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment